473,324 Members | 2,196 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

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 4499
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

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

Similar topics

3
by: Maxwell Hammer | last post by:
An application I am developing executes many threads and then has a "monitor" part that waits for certain events. One of these events causes the application to have to shutdown. On shutdown the...
8
by: JKop | last post by:
Let's say that when your program ends (no matter how) that you want a certain block of code to be executed at the end. Here's the code: std::cout << "The program will now end.\n";...
1
by: rivka.howley | last post by:
I have a subform where I added some code to the on_exit events for several controls on the subform. Now, if the cursor is in one of these controls when you click on a navigation button (the...
17
by: jwaixs | last post by:
Hello, I was wondering, what's the difference between exit and return in the main() function? For me they both look the same, or aren't they? And if they aren't, which should I use in which...
20
by: lovecreatesbeauty | last post by:
Hello experts, Is the following code snippet legal? If it is, how can exit() do the keyword return a favor and give a return value to the main function? Can a function call (or only this...
3
by: carl.dhalluin | last post by:
Hi, I am playing with the atexit module but I don't find a way to see the difference between a script calling sys.exit(<returncode>) and the interpreting arriving at the end of the source code...
16
by: Laurent Deniau | last post by:
I would like to know if the use of the pointer ref in the function cleanup() below is valid or if something in the norm prevents this kind of cross-reference during exit(). I haven't seen anything...
9
by: titanandrews | last post by:
Hi All, Is there any way to catch the exit code from someone calling exit(status) and check the value before the program terminates? Just for an idea, the code I'm thinking of is something...
11
by: Rahul | last post by:
Hi Everyone, I have seen code in different styles like main(argc,argv) int argc; char **argv; { if(argc != 2) exit(1); else exit(0);
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.