Type safety could prevent nuclear war

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


On Thursday, 4 February 2016 at 23:25:58 UTC, Ola Fosheim Grøstad 
wrote:
> On Thursday, 4 February 2016 at 23:21:54 UTC, tsbockman wrote:
>> It should just see that the post-preprocessor signatures of 
>> `spectral_contrast()` in match.c and spectral_contrast.c are 
>> in conflict, and either issue a warning, or refuse to link 
>> them at all.
>
> Has nothing to do with the preprocessor.

Yes, that was my point...

> He defined float_t to be an alias for double in one compilation 
> unit, and float_t to be an alias for float in another 
> compilation unit.
>
> In C, compilation units are completely independent, and can in 
> fact come from different compilers and different languages. C 
> is very much a system level programming language.

Just because *sometimes* the source code of the other module must 
be compiled independently, is a poor excuse to skip obvious, 
useful safety checks *all* the time.


More information about the Digitalmars-d mailing list