POV-Ray : Newsgroups : povray.programming : cleaning source code from warnings troubles : Re: cleaning source code from warnings troubles Server Time
28 Jul 2024 08:36:19 EDT (-0400)
  Re: cleaning source code from warnings troubles  
From: Thorsten Froehlich
Date: 23 Sep 2002 04:51:21
Message: <3d8ed609$1@news.povray.org>
In article <28gtou4t56f843790s28f5r236q80k3boi@4ax.com> , ABX 
<abx### [at] abxartpl>  wrote:

> warnings when -Wall setting is used with gcc

Using all gcc warning is pointless.  Gcc supports 8 and 16 bit platforms,
and many warnings the frontend will emit make a lot of sense when developing
for an embedded processor, but they just waste your time on desktop or
server system.

In particular the implicit type conversion warnings are the biggest nonsense
in both gcc and VC because C as well as C++ explicitly define which implicit
type conversions exist and how they behave.  It is obvious that a compiler
should not warn about perfectly legal and well behaving code by default.  If
it does it tries to enforce a certain style of programming the compiler
developer seems to prefer, but in this case it fails the basic usability
requirement of all software, which is the a machine should never be the
master of a human!

Of course, setting the maximum warning level changes this rule (it should
then warn about everything it can detect), but such a thing does not belong
into the default warning set, but the all warning set (gcc and VC warn by
default about this incorrectly).

In particular important is that explicit conversions, if used incorrectly to
get rid of compiler warnings can degrade performance (because you could be
tempted to first bit-mask integers for example).

On the other hand the compilers do fail miserably to detect truly
non-portable and dangerous code like that in the octree.cpp, also it is well
within their theoretical power to detect such code with little overhead in
their dataflow analysis module...

> 1. "aggregate has a partly bracketed initializer"

No idea what it is complaining about.  The code is perfectly legal.

> 2. "multi-character character constant"

These are nonsensical compiler warnings for perfectly legal and portable
code as long as the platform being used has 32 bit or bigger ints.  As
POV-Ray will not run on 16 bit processors, you can just disable those
warnings, like the compiler developers should have done in the first place
when the target code is for a platform whose ints (or other variable sizes)
can hold the data without problems.

    Thorsten

____________________________________________________
Thorsten Froehlich, Duisburg, Germany
e-mail: tho### [at] trfde

Visit POV-Ray on the web: http://mac.povray.org


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.