Casting away const

Steven Schveighoffer schveiguy at yahoo.com
Mon Aug 9 11:49:42 PDT 2010


On Mon, 09 Aug 2010 14:39:58 -0400, Lutger <lutger.blijdestijn at gmail.com>  
wrote:

> bearophile wrote:
>
>> Mafi:
>>> I think, that isn't a good idea.
>>
>> I agree, that idea doesn't work well.
>>
>> Bye,
>> bearophile
>
> I think it still is a good idea to forbid this in safe mode. Perhaps in  
> trusted
> too.

Note, this isn't any less safe than defining whatever you want for a C  
function:

extern(C) int strlen(int x);

C has no mangling, so there is no storage of parameter types in the  
symbol.  You can call any C function with whatever parameters you want to  
define for them.  Making some set of parameters illegal because in some  
cases it might not be true where you don't prevent it in others because  
you can't prove it, is just simply useless.

-Steve


More information about the Digitalmars-d-learn mailing list