Since when do void functions return values??
I've been trying to compile GNOME 2.10 on Solaris using Forte for over a
week now, and I have to say I'm amazed at the number of times I've had to
fix code that has a function that is declared to be "void"
- ie. doesn't return a value, but in the function implementation there is
a line "return
" - while this may compile with GCC - which surprises me in it self
- it's just not correct C syntax and the Forte compiles don't tollerate
it, which I think is perfectly fine.
I suppose this also works otherways - GCC has the nice feature of __FUNCTION__ being a string that's available for printf type debugging to provide useful information as to the locality of an assertion or such, but again this doesn't work in all compilers - it would be a nice feature, if it did, but the reality of the situation is that it doesn't - so please only use it if you wrap it in a #ifdef _GNUC_ / #endif.
So why is this happening, is GCC becoming like Visual Basic -- accepting things that are not strictly correct, but allow them to be used anyway? I certainly hope not. Or maybe it's just people are correctly making use of the -Wall and -Werror flags for gcc - it's certainly good practice, and if you really want to learn a language and write bug-free code it's the best way...
Maybe this is where it would be a good idea for people working in the community to use other complers.. So guys, Forte is now available for free use in conjunction with Open Solaris - so maybe this is the time to do it...
PS - I hope to get around to providing the necessary patches for the community soon to fix the one's I've come across so far...
I suppose this also works otherways - GCC has the nice feature of __FUNCTION__ being a string that's available for printf type debugging to provide useful information as to the locality of an assertion or such, but again this doesn't work in all compilers - it would be a nice feature, if it did, but the reality of the situation is that it doesn't - so please only use it if you wrap it in a #ifdef _GNUC_ / #endif.
So why is this happening, is GCC becoming like Visual Basic -- accepting things that are not strictly correct, but allow them to be used anyway? I certainly hope not. Or maybe it's just people are correctly making use of the -Wall and -Werror flags for gcc - it's certainly good practice, and if you really want to learn a language and write bug-free code it's the best way...
Maybe this is where it would be a good idea for people working in the community to use other complers.. So guys, Forte is now available for free use in conjunction with Open Solaris - so maybe this is the time to do it...
PS - I hope to get around to providing the necessary patches for the community soon to fix the one's I've come across so far...
Posted by Adam Leventhal on June 23, 2005 at 07:47 PM IST #
See http://docs.sun.com/source/819-0494/c99.app.html#marker-1003910
Posted by Alan Coopersmith on June 24, 2005 at 03:25 AM IST #
Posted by Phentermine on April 07, 2006 at 08:02 PM IST #