On 2005-04-27 11:37:51 +0100, Andrew Haley wrote:
> Warnings are to help the programmer see where there is some code that,
> although not necessarily an error, may require some attention.  This
> is a classic case of such a warning.  This warning really does
> indicate to the programmer that there might be a real problem.

On the other hand, too many warnings may annoy the programmer and have
the opposite effect.

>  > and IMHO, there should be a way to disable it (possibly locally to
>  > some part of the program).
> 
> Why not just fix the code?

I don't like the word "fix" since it is correct. It could be probably
OK here, but not necessarily a good thing in other contexts. In other
places, spurious warnings given by gcc cannot be avoidable.

>  > But if they are never modified, they evaluate to constants, right?
>  > 
>  > The fact that they are not considered as constant expressions,
>  > is it due to the fact that the environment is allowed to modify
>  > them?
> 
> It's due to what the C standard says.  A const variable in C isn't a
> constant, it's just a read-only variable.

1+1 isn't a constant either, but is allowed anyway.
I'm talking about constant *expressions*.

-- 
Vincent Lefèvre <[EMAIL PROTECTED]> - Web: <http://www.vinc17.org/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.org/blog/>
Work: CR INRIA - computer arithmetic / SPACES project at LORIA

Reply via email to