toString vs. toUtf8

Robert DaSilva sp.unit.262+digitalmars at gmail.com
Mon Nov 19 20:09:49 PST 2007


Jason House wrote:
> Robert DaSilva wrote:
> 
>> Jason House wrote:
>>> Walter Bright wrote:
>>>
>>>> Gregor Richards wrote:
>>>>> Would you prefer if int => int32, long =>
>>>>> int64, short => int16, byte => int8, real => float80 (portability be
>>>>> damned), double => float64, float => float32? They'd certainly be more
>>>>> obvious, but I can tell you I'd go crazy.
>>>> Those get requested now and then, but I agree they are awful. They're a
>>>> legacy from the C world where the sizes of basic types are unknown.
>>> The first bullet on http://www.digitalmars.com/d/portability.html implies
>>> some wiggle room on this issue.
>>>
>>> I really liked how D got rid of size ambiguity at first... all the way
>>> until
>>> I started developing on machines that were not 32 bit.  When I don't care
>>> about the true size, I feel guilty using "int" all over the place because
>>> it is a fixed size.
>>>
>>> I'd love to see both a fixed and variable size option available.  Maybe:
>>> int - variable size
>>> int32 - fixed size
>>> int64 - fixed size
>>>
>>> If that's done, the size of types become obvious when the programmer
>>> cares about them and may make size-sensitive code more obvious.
>> Even on 64-bit systems int is 32-bit.
> 
> Are you talking about what D does or what is most efficient on a 64 bit
> system?  If 32-bit integers are less efficient, then it's a crime to make
> size-tolerant code use an inefficient size.

C don't specify the sizes, but it does specify the sizes relative to
each other.
sizeof(short) <= sizeof(int) && sizeof(int) <= sizeof(long)



More information about the Digitalmars-d mailing list