Portable code

“Marc A. Lepage” wrote:

Scope of variables, I know from discussions with others there are
quite a few opinions on this subject. My personal opinion is that
for,while,do, etc… are scope modifiers, and that variables defined
within that scope should go out of scope when exiting the scope
statement.

It’s not a question of personal belief. I just posted the relevant
section of the C++ standard! VC++ is outdated and incorrectly scopes
variables declared in the conditions of for statements. This is a
porting issue that any significant body of code will tickle.

Definitely not a question of opinions or beliefs. We ported Quadra to
Linux with the egcs that comes with Red Hat, using the -Wall and
-pedantic options and it gaves us a gazillion warnings or errors about
that.

I do not remember if it did accept the code with a loud warning or if it
choked with an error, but there was enough complaining going around that
we fixed it all.–
Pierre Phaneuf
Systems Exorcist