void foo(); { cout << "foo" << endl; }This will result in an error like
test.cc:2: parse error before `{'
.
void foo() { cout << "hello world! << endl; }This will result in an error like
string.cc:5: unterminated string or character constant string.cc:5: possible real start of unterminated constant
;
at the end of an enum/union/struct definition. Can result
in lots of compile errors.
(
, )
, {
or }
.
This will also produce lots of compiler errors.
A possible solution is using an editor with the ability to match ()
and {}
, like vi and emacs.
.h
files. Will generate an error like header.h:1: macro or `#include' recursion too deep
. #ifndef
command, like #ifndef _
filename_H_
#define _
filename_H_
#endif
int
, not to
void
.
int the_answer();and implementing it like this:
unsigned int the_answer() { return 42; }This will result in an error like:
return.c:10: conflicting types for `the_answer' return.c:5: previous declaration of `the_answer'The solution is to make the two return types the same.