>popularity. Second, Microsoft's C++ compiler is a disaster. It doesn't even
>know how to handle simple things like:
>
>for (int i=1; i<10; i++) { // do some stuff... }
>for (int i=1; i<10; i++) { // do some other stuff... }
>
>I mean, the fact the "i" is used twice is something it can't grasp (in VC
>5.0, didn't try 6.0). Here at my company, we have a cross platform code
base
>compiled for several environments, and VC++ is the one which gives us the
>most headaches and troubles.
um, but isn't that illegal C++? you're redeclaring the variable. it is
declared inline, so it's scope ends when the scope outside of the for()
ends, NOT when the for itself ends. maybe you have a compiler that allows
you to make this mistake and clean it up for you. personally, i would
rather the compiler warn me that i just did something that might not be what
i intended. imagine if i was expecting the compiler to warn me -- i might
be looking at the value of "i" near the bottom of the function, and later i
cut-and-paste another "for()" loop in, and oops it happens to redeclare "i",
and now the rest of my algorithm is busted. (obviously there are
cut-and-paste scenarios that don't get caught by this -- that's not the
point; i'm saying i'm thankful that the compiler complains about illegal
code).
>Therefore, I think that tying someone to using VC++ is a very, very bad
>idea. Microsoft has a very personal view of how a language should be used,
>and what features it should provide. And sometimes this view doesn't match
>the standard. This is the thing I don't like, having to maintain code which
>compiles and run on several platforms.
isn't that a little harsh? VC++ has switches to turn off ALL the
non-standard extensions. and they're exactly that: extensions. VC++
implements a complete superset of the standard.
your situation is special: you are writing code that you want at least 2
different compilers to transparently magically compile correctly with no
extra effort from yourself. that's a reasonable desire, certainly! but i'm
not sure it's realistic with the current tools available, regardless of
whether one of the compilers happens to be a MS compiler. i have to ask --
is this really a problem exclusive to VC++, or is this just the same old
"compiler A has slightly different behavior from compiler B, and now that i
know about it i can work around it very easily". no two compilers i've ever
used have magically been able to compile the same (medium-to-large) codebase
without some tweaking of either compiler switches or the codebase itself.
(as always, your mileage may vary).