octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: C++ coding style and in-place operators


From: Jordi Gutiérrez Hermoso
Subject: Re: C++ coding style and in-place operators
Date: Mon, 25 May 2015 17:04:20 -0400

On Sun, 2015-05-24 at 07:52 -0700, rik wrote:
> Do we have a preference for where in-place operators are used?  For
> example, the following statement can be coded two ways.
> 
> a = a + 1;
> a += 1;
[snip]
> In the C++ code, do we assume the compilers are smart enough these
> days to perform that optimization?

I believe that even without optimisations both of those instructions
compile to the same assembly. But as a matter of style, if we're doing
+= in m-files, it makes sense to follow the same style in C++. It
certainly won't be slower than the longer version.

- Jordi G. H.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]