This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: why are we not using const?

On 29 June 2006 14:55, Andrew Pinski wrote:

> On Jun 29, 2006, at 9:51 AM, Dave Korn wrote:
>>    That's cheating!  You casted away const, it's a blatant aliasing
>> violation, you deserve everything you get.
> No it is not, in fact it is legal C and there is no aliasing
> violation as you
> are still accessing the memory as an "int".

  Sorry, 'aliasing' was the wrong choice of word.  But it's really legal to
cast away const?  I'm boggled.  In that case it simply might as well not exist
at all; it conveys no usable semantic information.  I would argue that const
should be removed from the language if this is the case; if all you want is to
document the properties of function args, it makes more sense to do it with
macros that #define to nothing, like M$ does with 'IN', 'OUT', 'OPTIONAL' and
so on in all their header files.

<scurries off to dig up a copy of the standard and refresh my memory with the
details of const...>

Can't think of a witty .sigline today....

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]