END/STOP and destructors

For other topics related to the FreeBASIC project or its community.
Posts: 329
Joined: Nov 28, 2012 1:27
Location: California

Re: END/STOP and destructors

Postby speedfixer » Apr 19, 2018 5:43


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


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

Re: END/STOP and destructors

Postby fxm » Apr 19, 2018 7:59

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.
Site Admin
Posts: 2881
Joined: Nov 04, 2005 14:23
Location: Ontario, Canada

Re: END/STOP and destructors

Postby coderJeff » Apr 19, 2018 13:27

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).

These are the statements written in your main source module. From a simplistic point of view this is where the FreeBASIC program actually starts.

Return to “Community Discussion”

Who is online

Users browsing this forum: No registered users and 1 guest