Type safety could prevent nuclear war

tsbockman via Digitalmars-d digitalmars-d at puremagic.com
Thu Feb 4 15:24:21 PST 2016


On Thursday, 4 February 2016 at 23:19:20 UTC, Ola Fosheim Grøstad 
wrote:
> On Thursday, 4 February 2016 at 22:57:00 UTC, tsbockman wrote:
>> Actually, I'm surprised that this works even in C - I would 
>> have expected at least a compiler (or linker?) warning; this 
>> seems like it should be easy to detect automatically.
>
> AFAICT C would have complained if he had included <math.h>. 
> This is a rather unlikely mistake...
>
> Anyway, in C being able to work around restrictions is 
> sometimes desired, so... if you don't want the ability to do 
> it, don't use C.

What restriction does not checking, by default, that the 
parameter types match allow one to work around, though?

C already has `void*` and explicit casts, either of which would 
allow one to explicitly indicate that type checking is not 
desired.


More information about the Digitalmars-d mailing list