You are not logged in.

#1 2009-08-23 18:02:16

BlueChip
Moderator

atexit()

I think we should consider using atexit() to ensure GRRLIB_exit is called when the program terminates.
http://linux.die.net/man/3/atexit

However, we may need to educate some programmers that they should (always) use exit(), not return, to terminate main()

BC


I can be found on efnet, freenode, msn, gtalk, aim, ychat & icq ...PM me for details

Offline

 

#2 2009-08-23 22:49:39

jespa
Member

Re: atexit()

It's a good idea to add the line atexit(GRRLIB_exit); inside the function GRRLIB_Init(), and ensure the GRRLIB_exit() funtion is not called twice, but forget about educate anybody. In fact, doing a return from main WILL execute functions declared with atexit()


The atexit() function registers the given function to be called at normal process termination, either via exit() or via return from the program's main().

Offline

 

#3 2009-08-24 11:49:38

BlueChip
Moderator

Re: atexit()

I never realised that atexit() did not require exit() ...always one more thing to learn smile ...And useful, as "educating the masses" is not an easy task.
As you say, we also need to add some code to stop repeated calls of code which does not like it.
v4.1.0 is taking a while [while we sort out examples, documentation, etc] ...maybe we can get it done before the point-release smile

BC


I can be found on efnet, freenode, msn, gtalk, aim, ychat & icq ...PM me for details

Offline

 

Board footer

Powered by FluxBB