octave-maintainers
[Top][All Lists]
Advanced

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

C++ coding style and in-place operators


From: rik
Subject: C++ coding style and in-place operators
Date: Sun, 24 May 2015 07:52:59 -0700

5/24/15

All,

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;

In m-files there is a distinct preference for the in-place operator which
is faster as it doesn't allocate an intermediate variable.  In the C++
code, do we assume the compilers are smart enough these days to perform
that optimization?  And even if they are, do we like one style more than
the other?

Attached is a list in liboctave of opportunities to use in-place operators
that I quickly found using regular expressions.

--Rik

Attachment: inplace.list
Description: Text document


reply via email to

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