On Saturday, 8 June 2013 at 22:55:20 UTC, Walter Bright wrote:
On 6/8/2013 2:23 PM, bearophile wrote:
- D integer types have guaranteed sizes, but
  they're not obvious from the name
- Why not have int8, uint8, int32, uint32, etc. in
  default namespace, encourage their use?

I agree. It's hard to guess the size and signedness of types as byte, ubyte,
wchar, dchar. I prefer names that are more clear.

It would only be a trivial problem for 5 minutes, only for ex-C/C++ programmers who are used to suffering under variable sized ints, and will never be a problem again.

Is it really a problem to guess the size of 'byte'? Or that 'ubyte' is unsigned? Come on, bearophile!

And frankly, int32, long64, etc., have a large 'yech' factor for me.

Besides, if you really do want them,

    import core.stdc.stdint;

It was a relief to go from C++ to D and be guaranteed the sizes. No 'u' is signed, 'u' is unsigned, simple as simple gets. Took me a little while to learn and adjust, but not much.

I didn't know about core.stdc.stdint; I may use it for the few cases where the size is very important with no room for erroneously choosing the wrong one.

Slam dunk!

--rt

Reply via email to