473,395 Members | 1,668 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,395 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 4503
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.