On Sat, Mar 15, 2003 at 08:06:33PM +0000, Bruynooghe Floris wrote: > On Fri, Mar 14, 2003 at 06:12:28PM +0000, Pigeon wrote: > > #include <stdlib.h> // need this to use malloc() > > Well I thought so to, but it _did_ work without to my surprise (discovered after > I stupidly forgot it)
The straight-C-compatible version does. C++ is more fussy about declarations, so the C++-required version causes g++ to moan if you don't include the header file. Using undeclared functions can land you in trouble eventually; the options -Wmissing-prototypes, -Wmissing-declarations and -Wstrict-prototypes are useful, I think. The idea is to ensure that the straight-C compiler moans if you forget a header file or declare your own functions 'loosely'. > But using `//' is also a C++ism no? Indeed so. I used that form to emphasise that "this version contains C++isms". > BTW; thanks to all of you for the replies, I couldn't find this in any book (not > even K&R). "Glad to be of service" :-) Pigeon -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]