> 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".
 > -- Pinski

"Legal" does not mean it's a good idea.  Bypassing const through casts
is like ignoring documentation.  You get what you deserve.

E.g. if the object referred to by the pointer is in a read-only
section, casting away const-ness and modifying it leads to a core
dump...

                --Kaveh
--
Kaveh R. Ghazi                  [EMAIL PROTECTED]

Reply via email to