Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > For Loop Scope

Thread Tools

For Loop Scope

Ron Natalie
Posts: n/a

"Dhruv" <(E-Mail Removed)> wrote in message news(E-Mail Removed)...

> Talking about compilers and optimization, I'd like to vote for g++. Though
> it might not be as compiliant as Intel, it sure does optimize well.

You have got to be kidding. G++ (at least on the Pentiums) generates
horrendously bad code. The optimizer is absolutely ignorant of the concepts
required to produce good PII code. The Intel compiler is a world of difference.

Reply With Quote
Jerry Coffin
Posts: n/a
In article <(E-Mail Removed)>, Removed)

[ ... ]

> Talking about compilers and optimization, I'd like to vote for g++. Though
> it might not be as compiliant as Intel, it sure does optimize well.

I hesitated to mention optimization at all, largely because it's
practically an invitation to a flamewar. Therefore, I'm going to do my
best to be very careful in how I reply to this.

Optimization is a rather strange situation -- though optimization and
testing of it seem like they should both be quite exact sciences, my
experience indicates that they're far less so than most people believe.
I suspect part of the reason for this is that different compilers
produce good code for different kinds of input.

Regardless of the exact reasons, the result is fairly simple: there's
nearly no such thing as a "fair" benchmark in any abstract sense, and
the compiler with which you get the best results seems (in my
experience) to indicate more about the code you write than about the
compiler itself. That's not to say anything about the quality of the
code involved, only that I think people quickly pick up on the odd
quirks of how their compiler generates code, and without conscious
effort (or often even any awareness of it) tailor their code to suit.

The result is that it's virtually impossible to find "neutral" code that
really gives a good indication of the compiler rather than the coder.
The closest I've been able to find (at least of what's easily available)
is a rather large collection of benchmarks named Bench++, compiled (no
pun intended) by Joe Orost. The reason I tend to consider this closer
to "neutral" than most others is fairly simple: an awful lot of the code
is transliterated from FORTRAN, Ada, etc., which helps prevent it from
being tailored to a particular compiler. Another good point is its
sheer size, and the number of different things it tests -- it's hard for
me to imagine that with so many substantially different kinds of tests,
it can keep from giving at least some indication of the compiler's
quality. Nicely enough, it also includes a fair number of Alexander
Stepanov's tests of how a compiler handles different levels of
abstraction, so even if you don't want to compare one compiler to
another, at least part of the results can still be useful and

> Another thing to take into account would be the STL provided by the
> compiler.

IMO, given the relative ease with which it can be replaced, this is a
minor factor at most. Just for an obvious example, I'm pretty sure I've
gotten STLPort set up in under 10 minutes. My experiences with it
haven't matched yours, so I haven't continued to use it on a regular
basis, but getting it set up so I _could_ use it was trivial.


The universe is a figment of its own imagination.
Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Triple nested loop python (While loop insde of for loop inside ofwhile loop) Isaac Won Python 9 03-04-2013 10:08 AM
Re: Lexical scope vs. dynamic scope Xah Lee Java 0 02-26-2009 10:08 AM
Scope - do I need two identical classes, each with different scope? ann Java 13 09-13-2005 03:07 AM
How do namespace scope and class scope differ? Steven T. Hatton C++ 9 07-19-2005 06:07 PM
IMPORT STATIC; Why is "import static" file scope? Why not class scope? Paul Opal Java 12 10-10-2004 11:01 PM