Re: Is Learning 2 Programming languages at once possible?
@Camlorn, please read exactly what others post about programming languages before you go on rants like you did in post 9. You did not realize what Danny was saying. He did not say that everyone should use PB. He just said he's comfortable with it. Again, I ask you nicely to re-read Danny's posts.
Edit:
PB is not C in any way, shape or form. It does not have the syntax that C has; it does not use any C libraries whatsoever; and it does not generate C code and then use another compiler to accomplish its goal. It, in fact, uses pure assembly. Every single library is written in assembly and converted to binary code using the Flat Assembler (fasm.exe on Windows, fasm on Linux, and Yasm on OS X). When you compile something, it translates your code to assembly and then assembles and links the code.
As an example, I'll demonstrate this in practice:
In PB, asking the user for input is as simple as doing:
PrintN ("Enter a message.")
Inp
ut()
When compiling PB code, the compiler takes this code and translates it into the following:
;
; PureBasic 5.31 (Windows - x86) generated code
;
; (c) 2014 Fantaisie Software
;
; The header must remain intact for Re-Assembly
;
; Console
; :System
; KERNEL32
; :Import
;
format MS COFF
;
;
extrn _PB_Input
extrn _PB_PrintN
extrn _ExitProcess@4
extrn _GetModuleHandleA@4
extrn _HeapCreate@12
extrn _HeapDestroy@4
extrn _memset
extrn PB_StringBase
extrn _SYS_InitString@0
extrn _SYS_FreeStrings@0
;
extrn _PB_StringBasePosition
public _PB_Instance
public _PB_ExecutableType
public _PB_OpenGLSubsystem
public _PB_MemoryBase
public PB_Instance
public PB_MemoryBase
public _PB_EndFunctions
macro pb_public symbol
{
public _#symbol
public symbol
_#symbol:
symbol:
}
macro pb_align value { rb (value-1) - ($-_PB_DataSection + value-1) mod value }
macro pb_bssalign value { rb (value-1) - ($-_PB_BSSSection + value-1) mod value }
public PureBasicStart
;
section '.code' code readable executable align 4096
;
;
PureBasicStart:
;
PUSH dword I_BSSEnd-I_BSSStart
PUSH dword 0
PUSH dword I_BSSStart
CALL _memset
ADD esp,12
PUSH dword 0
CALL _GetModuleHandleA@4
MOV [_PB_Instance],eax
PUSH dword 0
PUSH dword 4096
PUSH dword 0
CALL _HeapCreate@12
MOV [PB_MemoryBase],eax
CALL _SYS_InitString@0
; PrintN ("Enter a message.")
PUSH dwor
d _S1
CALL dword [_PB_PrintN]
; Input()
MOV edx,[_PB_StringBasePosition]
PUSH edx
PUSH edx
CALL dword [_PB_Input]
POP dword [_PB_StringBasePosition]
_PB_EOP_NoValue:
PUSH dword 0
_PB_EOP:
CALL _PB_EndFunctions
CALL _SYS_FreeStrings@0
PUSH dword [PB_MemoryBase]
CALL _HeapDestroy@4
CALL _ExitProcess@4
_PB_EndFunctions:
RET
;
;
section '.data' data readable writeable
;
_PB_DataSection:
_PB_OpenGLSubsystem: db 0
pb_public PB_DEBUGGER_LineNumber
dd -1
pb_public PB_DEBUGGER_IncludedFiles
dd 0
pb_public PB_DEBUGGER_FileName
db 0
pb_public PB_Co
mpiler_Unicode
dd 0
pb_public PB_Compiler_Thread
dd 0
pb_public PB_Compiler_Purifier
dd 0
pb_public PB_Compiler_Debugger
dd 0
_PB_ExecutableType: dd 0
public _SYS_StaticStringStart
_SYS_StaticStringStart:
_S1: db "Enter a message.",0
pb_public PB_NullString
db 0
public _SYS_StaticStringEnd
_SYS_StaticStringEnd:
align 4
align 4
align 4
s_s:
dd 0
dd -1
align 4
;
section '.bss' readable writeable
_PB_BSSSection:
align 4
;
I_BSSStart:
_PB_MemoryBase:
PB_MemoryBase: rd 1
_PB_Instance:
PB_Instance: rd 1
;
align 4
PB_DataPointer rd 1
align 4
align 4
align 4
align 4
I_BSSEnd:
section
9;.code' code readable executable align 4096
section '.data' data readable writeable
SYS_EndDataSection:
That is what happends during compilation: Write PB code, check the sntax, covert the code to ASM, check the ASM code with FASM, assemble it, and link it to produce an executable program.
_______________________________________________ Audiogames-reflector mailing list Audiogames-reflector@sabahattin-gucukoglu.com https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector