Advertisement

Must return a value

Started by December 11, 2005 02:41 PM
3 comments, last by NicoDeLuciferi 18 years, 10 months ago
One of the things that annoys me is that g++ lets me get away with not returning a value in a function that expects it. VC++ won't let me. So porting my game from Linux to Windows can be a pain when I discover that some stupid little function somewhere doesn't return a value. But g++ does give a warning, but I admit that I don't always pay attention to the warnings. Is there a pragma or something like that that lets me turn that specific warning into an error? Or is there some other way to get g++ to be a little more assertive about that (without doing something drastic like setting all warnings as errors)?
I like the DARK layout!
Don't know about g++, but I have to say I'm working in a team
with around 6+ developers, and we did switch "warnings as errors"
on (some people were ignoring warnings all the time).. Now, they can't :)

...and if you fix these (usually trivial things) immediately, you don't
end up with a huge pile of annoying warnings :)
visit my website at www.kalmiya.com
Advertisement
why not just use g++ on windows?
I typically use "-Wall -Wextra", and listen to all the warnings. If you don't trust yourself to listen to the warnings, there's nothing wrong with using "-Werror"

Really, though, you should listen to all the warnings that are given. Usually, they indicate something with your code that you should look at closely.
You can use '-pedantic-errors' but that implies '-pedantic' which you might not want, but I will convert warnings to errors.

/Nico

This topic is closed to new replies.

Advertisement