While perusing some C++ code changes this morning I noticed again the
wide-spread use of two idioms that Scott Meyers specifically
recommends another version of, to wit:

1.  Prefer to test STL containers for empty rather than compare their
size to zero (e.g., use "container.empty()" [or its negative] instead
of comparing "container.size()" with zero).

and

2.  You should prefer the pre-increment operator (++iter) to
post-increment operator (iter++) if you are not going to use the old
value.

The first defense against using Meyers' suggestions is something like
"it makes no major difference in most cases" and that may be true;
however, I believe it is part of a good coding habit that instills a
sense of efficient coding while also contributing to a clean and
consistent coding style.

Any consideration to adding adding some of Meyers' "preferences" to HACKING?

Any objection to a C++ Meyers fan changing such code where found?

Happy New Year!

Best regards,

-Tom

------------------------------------------------------------------------------
Master SQL Server Development, Administration, T-SQL, SSAS, SSIS, SSRS
and more. Get SQL Server skills now (including 2012) with LearnDevNow -
200+ hours of step-by-step video tutorials by Microsoft MVPs and experts.
SALE $99.99 this month only - learn more at:
http://p.sf.net/sfu/learnmore_122512
_______________________________________________
BRL-CAD Developer mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-devel

Reply via email to