END/STOP and destructors

General discussion for topics related to the FreeBASIC project or its community.
speedfixer
Posts: 606
Joined: Nov 28, 2012 1:27
Location: CA, USA moving to WA, USA
Contact:

Re: END/STOP and destructors

Post by speedfixer »

@fxm:

Not sure what you are doing, but for me - both compile without -exx as noted.

@coderjeff:

What is the difference between step 4 and step 6?
fxm
Moderator
Posts: 12081
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: END/STOP and destructors

Post by fxm »

speedfixer wrote:

Code: Select all

.....
''----------  case 3  -------------

'dim as string a(5)
'print a(9)

' compile with no -exx:
'   screen crash, seg fault

''----------  case 4 -------------

'dim as string a(5)
'print "AAA"
'print a(9); "XXX"

' compile with no -exx:
'   AAA, XXX, ZZZ, DDD, no message
.....
Cases 3 and 4 do not compile at all.
(test it if you are not convinced)
fxm wrote: (the value limits of numeric literals used as static array indexes are always checked at compile phase)
With "redim as string a(5)", this would compile.
coderJeff
Site Admin
Posts: 4313
Joined: Nov 04, 2005 14:23
Location: Ontario, Canada
Contact:

Re: END/STOP and destructors

Post by coderJeff »

speedfixer wrote:What is the difference between step 4 and step 6?
Yeah, it's almost the same thing; I was attempting to highlight what I think is an important detail in the startup:

4) call fbc MAIN() - this is YOUR (implicit) main function in the main module
This is an actual procedure entry point "main(argc, argv[])" in the linker's namespace like in C. It's the "main" entry point for your program from the perspective of the CRT start up code. If your are running a debugger and set a breakpoint on "main" this is where it stops.

5) call to fb_Init() to finish init of the program
This is automatically added by fbc to the start of your implicit main function before any of your statements. Initialization of fbrt is not quite finished yet: the call to fb_Init() passes argc/argv[] to fbrt so that COMMAND() will work and passes compile-time __FB_LANG__ constant so that rtlib can respect dialect dependent behaviours (I think only RND() function is affected).

6) YOUR PROGRAM HERE
These are the statements written in your main source module. From a simplistic point of view this is where the FreeBASIC program actually starts.
Post Reply