Hi Sukender,

On Thu, Jan 8, 2009 at 12:28 PM, Sukender <[email protected]> wrote:
> Mmmh... I understand. The fact is that in every company I worked, the 
> affectation in a "if" was simply forbidden... when not "strongly 
> discouraged". Anyway, the only thing important is to be aware of such 
> things... (after paying attention to the algorithm errors, as you say, of 
> course!)

C++ certainly gives you lots of rope to hang yourself with, being able
to assign values to variables within an expression is just one
example.

If companies want to forbid certain language features from being used
then perhaps C++ might be the wrong language for them... as there are
just so many different little caveats in usage of C++ that you can
never catch all of them with a set of strict policies.

Personally I would advocate education of C++ programmers of good
programming practices with an emphasis on understand why they are good
and the scope that such a practice has, as a "good" programming
practice applied at the wrong time can be rather detrimental.  A
number of years back a read an Anti-Pattern book that was good a
highlighting this.

Some groups set policies on 0 tolerance of warnings, upping warnings
to max, with the belief that this will lead to better code, I feel
this is a praying to a false god though.  Warnings can often be
misleading and "fixing" them doesn't necessaryly lead to better code,
and if one isn't careful can introduce bugs and poorer
maintainability.  Warnings should be seen for they are, they are just
a hint to what the compiler guesses could be a potential problem in
the code.  With these higher levels of warnings the more speculative
the compiler is guessing at what is good practice and what isn't, and
the more false positives it produces in the process and the less
reliable they become.

If think with the speculative warning reports and the dodgy
workarounds like the !=0 trick which must be a built into compiler
work around in the compiler the more the compiler is leading away from
solid ground of compiliant C++ that should be the bedrock of
programming with C++.   A far more useful facility would be compilers
to just warning about non compliant/ambigus C++, and have the
speculative review of code that looks for common programming errors to
specialist code review programs that high potential programs with the
coder to review on screen and then tag as being OK or not and then
store that info so that future reviews don't highlight the false
positive, only reviewing the code if it's changed.  This type of app
wouldn't be run on every compile, just as a periodic code review.

Robert.
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to