This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Is this a bug?
- From: "Bill McEnaney" <bill at rkirkpat dot net>
- To: Bob Plantz <plantz at cds1 dot net>, Ian Lance Taylor <iant at google dot com>, Honggang Xu <hxu at zeugmasystems dot com>, Andrew Haley <aph at redhat dot com>, David Daney <ddaney at caviumnetworks dot com>, gcc-help at gcc dot gnu dot org
- Date: Thu, 16 Jul 2009 22:22:59 -0600 (MDT)
- Subject: Re: Is this a bug?
Bob told us his preference. So I'll admit my preferences: Haskell,
Ocaml, Prolog, Python, and Lisp, probably in that order.
Bill
> On Thu, 2009-07-16 at 17:31 -0700, Ian Lance Taylor wrote:
> > For an integer type there is no performance difference between ++x and
> > x++.
> >
> > For a C++ class which defines operator++ and a copy constructor, there
> > can be performance differences between ++x and x++. The latter often
> > requires the compiler to invoke the copy constructor to hold onto the
> > old value before invoking operator++. So if you are writing C++, it's
> > often a good idea to write ++x when x is a class type, such as an STL
> > iterator. The compiler can sometimes eliminate the copy constructor,
> > but not always.
> >
> > Ian
>
> Thank you, Ian. Being mostly a C programmer, I often forget about the
> things that C++ does behind the scenes.
>
> My real preference is assembly language. Then it's just me and the
> machine. ;)
>
> Bob
>
>
>
________________________________________________________________
Please visit a saintly hero:
http://www.jakemoore.org