I have this function:
int getBeer(){
std::cout << "drunk\n";
}
when I compile with g++ I don't get any error or warning. Why?
In addition to what Victor said, here's a platform-specific answer:
gcc does not turn on warnings by default. It is a good habit to
always compile your code with at least the following flags (assuming
your file is named "foo.cpp"):
g++ -Wall -Wextra -pedantic foo.cpp
That turns on many useful warnings. Some people add additional flags
to get more warnings. For additional info, consult the gcc manual, or
ask on a gcc-specific mailing list or forum.
Best regards,
Tom