"David Hamill" <[EMAIL PROTECTED]> wrote:
> Arindam Biswas wrote:
> > const int a = 10; // global
> > my_function()
> > {
> > const int b = 20; // local
> > }
> >
> > Will both 'a' and 'b' be stored in data segment?
>
> I suppose it depends on the compiler. K&R say that the const
> keyword may even be ignored by a compiler!
Yes, in the sense that if you remove every instance of const
(outside of string literals and the like obviously), the
semantics of the program will not change.
If code is broken with the consts in place, it is no less
broken without them! But removing them will not invalidate
strictly conforming code.
const is just an imperfect tool to the problem of imperfect
programmers. ;)
--
Peter