469,269 Members | 1,006 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,269 developers. It's quick & easy.

exit, atexit, on_exit

momotaro
357 100+
first question:
are they good to use in term of reliablity?
second question:
is on_exit Compatible with windows ?(I heard that it wasn't but I want confirmation)
Jul 31 '07 #1
7 4143
JosAH
11,448 Expert 8TB
first question:
are they good to use in term of reliablity?
second question:
is on_exit Compatible with windows ?(I heard that it wasn't but I want confirmation)
first answer: they're as reliable as the callback functions are, e.g. if you have
a callback function like this:

Expand|Select|Wrap|Line Numbers
  1. void foo() { for(;;); }
  2.  
you're dead.

second answer: I really wouldn't know. Microsoft loves to reinvent the wheels
big times and they want their methods to be named differently from the POSIX
specifications. Check their ever changing manuals and specifications.

kind regards,

Jos
Jul 31 '07 #2
weaknessforcats
9,208 Expert Mod 8TB
Avoid these things like the plague.

Imagine a server application with 450,000 lines of code and 3,000 people logged on and suddently BOOM! there's c:\>. I turn to you and say: Golly, where do you think that happened??

There is a orderly way to terminate a C++ program by using terminate() and unexpected() or by writing your own terminate() and unexpected() functions.

C programmers don't seem to care. 45 levels down the call stack and they call exit() to stop the program becuse there is no error or exception handling in C.
Jul 31 '07 #3
JosAH
11,448 Expert 8TB
C programmers don't seem to care. 45 levels down the call stack and they call exit() to stop the program becuse there is no error or exception handling in C.
Well, you have to give them *some* credits; they have setjmp() and longjmp()
you know ;-)

kind regards,

Jos
Jul 31 '07 #4
weaknessforcats
9,208 Expert Mod 8TB
they have setjmp() and longjmp()
Yes, they do. And void*. And bitifields. And other stuff that is just a notch above writing the assembly yourself.
Jul 31 '07 #5
drhowarddrfine
7,435 Expert 4TB
Everything should be done in assembly.
Jul 31 '07 #6
weaknessforcats
9,208 Expert Mod 8TB
Everything should be done in assembly.
Yes, the only true religion. When my machine was 128K it took a staff of 25 to maintain that assembly code. Those were the days. The machine cost $450/hr so we only got 4 assembles a year. The rest of the time we wrote in binary and added the assembly to the card deck for the next assemble.

One time I got called into the manager's office over:

LA 0

It was explained that loading the A register with zero took two bytes of memory wheres

XRA

that exclusive-or'd the A register with itself accomplished the same thing and took only one byte of memory.

It was suggested that I learn proper coding practices if I hoped to succeed as a programmer.

Unfortunately, the memory size and speed of modern computers has taken all the fun out of it.
Jul 31 '07 #7
drhowarddrfine
7,435 Expert 4TB
Anything over 16K is a waste.
Aug 1 '07 #8

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

8 posts views Thread by JKop | last post: by
17 posts views Thread by jwaixs | last post: by
20 posts views Thread by lovecreatesbeauty | last post: by
16 posts views Thread by Laurent Deniau | last post: by
9 posts views Thread by titanandrews | last post: by
11 posts views Thread by Rahul | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.