D2.0: an example of use-case for casting invariant away

Bruno Medeiros brunodomedeiros+spam at com.gmail
Mon Jun 25 12:37:23 PDT 2007


Daniel Keep wrote:
> "Damnit; I don't understand what's going wrong here."
> 
> "It looks like you're modifying const data.  Did you cast const away
> anywhere?"
> 
> "I use unConst, and I already checked all the lines that use that, and
> they're fine!"
> 
> "But what if you *forgot* to use unConst?"
> 
> "... Uh-oh."
> 
> The problem with your suggestions is that unless either A) it's
> compiler-enforced or B) humans suddenly become infallible, it's really
> not solving the problem at all.  If someone forgets to use unConst, or
> worse, casts away const *without realising it*, they're screwed.
> 
> And I *really* doubt B is going to happen.
> 
> 	-- Daniel


If you're not meant to write any cast, how the hell does one 
accidentally write a cast?
(http://www.flicklife.com/edecadcc9a8691762b4f/The_Daily_Show_Server_Crossfire.html 
:P )


-- 
Bruno Medeiros - MSc in CS/E student
http://www.prowiki.org/wiki4d/wiki.cgi?BrunoMedeiros#D



More information about the Digitalmars-d mailing list