g++ mini-FAQ


g++ has trouble with some explicit typecasts:

g++ doesn't like expressions of the form:    ... = unsigned int(foo);

g++ did like a C-style typecast:    ... = (unsigned int) (foo);

 

g++ objects to declaring a non-template friend function within a template declaration:

g++ doesn't like:    friend operator<<(ostream& Out, const foo<T>& Foo);
g++ did like:          friend operator<< <>(ostream& Out, const foo<T>& Foo);
 

g++ enforces the ISO Standard for loop scope rule:

 g++ doesn't like:

for (int Pos = 0; Pos < Limit; Pos++) {
   ...
}
if ( Pos == Limit )... // ISO says: this is an illegal reference

g++ does like:

int Pos;
for (Pos = 0; Pos < Limit; Pos++) {
...
}
if ( Pos == Limit )...

 

g++ whines about having no newline at end of input file:

g++ doesn't like source files that don't have a return at the end of the last line... just a warning and no big deal.