Integer conversions too pedantic in 64-bit
Daniel Gibson
metalcaedes at gmail.com
Tue Feb 15 14:46:46 PST 2011
Am 15.02.2011 23:43, schrieb Adam Ruppe:
> Daniel Gibson wrote:
>> Probably it would be helpful if size_t was a proper type that can't
>> be mixed with other types in dangerous ways without explicit casting.
>
> Bad idea: once you insert an explicit cast, you now have a *hidden*
> bug on the new platform instead of a compile error.
You should only cast when you know what you're doing..
If you get a compiler error on the new platform and just shut it up by doing an
explicit cast then, it's just as bad.
But having to do an explicit cast either way forces you to think about what
you're doing, hopefully avoiding large pieces of code that need to be rewritten
because they only worked because size_t was uint or such.
Cheers,
- Daniel
More information about the Digitalmars-d
mailing list