Randy Kramer wrote: > [EMAIL PROTECTED] wrote: > > Can we have a sort of middle point here? > > > > x = x * y should be replaced by x *= y > > (A newbie C/C++ question:) > > Just out of curiosity, is that just a "cosmetic" change, or does that > actually change the machine code emitted by the compiler? Both. It does affect semantics of the expression. For the expression x = x * y the non-optimizing compiler generates something like tmp = x.operator*(y); x = tmp; while x *= y becomes x.operator*=(y); For POD (Plain Old Data) types any reasonable optimizer generates the same code, but for an unoptimized build or when using non-trivial objects it can make quite a difference. /Mike
- suggestion: slight optimization for UT_String Joaqu�n Cuenca Abela
- Re: suggestion: slight optimization for UT_Strin... Mike Nordell
- Re: suggestion: slight optimization for UT_S... Joaqu�n Cuenca Abela
- Re: suggestion: slight optimization for ... Vlad Harchev
- Re: suggestion: slight optimization ... Joaquin Cuenca Abela
- Re: suggestion: slight optimiza... rms
- Re: suggestion: slight opti... Joaquin Cuenca Abela
- Re: suggestion: slight opti... Randy Kramer
- Re: suggestion: slight ... rms
- Re: Code generation [wa... Mike Nordell
- Re: Code generation [wa... Randy Kramer
- Re: suggestion: slight optimiza... Vlad Harchev
- Re: suggestion: slight opti... Joaqu�n Cuenca Abela
- Re: suggestion: slight optimization for ... Joaquin Cuenca Abela
- Re: suggestion: slight optimization for UT_Strin... Dom Lachowicz
