[NTLUG:Discuss] OT: C question
Burton Strauss
Burton_Strauss at comcast.net
Wed May 10 17:33:39 CDT 2006
Bus errors are usually hardware specific alignment problems.
(1) What's the hardware and compiler?
(2) Check the man page and make sure your zero is the right 'type' for the
function, e.g. return ((int)0);
-----Burton
-----Original Message-----
From: Discuss-bounces at ntlug.org [mailto:Discuss-bounces at ntlug.org] On Behalf
Of Fred James
Sent: Wednesday, May 10, 2006 5:16 PM
To: NTLUG Discussion List
Subject: [NTLUG:Discuss] OT: C question
All
I have a C program that if compiled with a "return (0);" as the last line in
main(), runs correctly but give a "Bus error(core dump)" message.
If I compile the same C program with a "exit (0);" as the last line in
main(), the run is also correct, and there is no error message.
What is the difference, please?
K&R says: "Within main, return expr is equivalent to exit(expr). (page 164,
paragraph 2, "The C Programming Language - Second Edition" by Brian W.
Kernighan, Dennis M. Ritchie, Prentice Hall Software Series, Copyright 1988,
1978, by Bell Telephone Laboratories, Incorporated).
The platform is SGI IRIX 6.4
Thank you in advance for any help you may be able to offer Regards Fred
James
_______________________________________________
http://ntlug.pmichaud.com/mailman/listinfo/discuss
More information about the Discuss
mailing list