toString vs. toUtf8
renoX
renosky at free.fr
Sun Nov 25 21:39:44 PST 2007
Jason House a écrit :
> renoX wrote:
>
>> Jason House a écrit :
>>> 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.
>> No!
>> Naturally programmers would use 'int' everywhere and this would create
>> again portability issue.
>
> What would the portability issue be? If they use int and don't care about
> the true size, it'll port fine.
Sure, it's the same as C, except that if you look to the real world,
you'd see that there are many portability issue in C due to this..
There are many not-very-good|overworked programmers who care only about
their current target, so if you have integers with a varying size as a
default portability will be poor.
IMHO, that's a case of 'premature optimisation', providing machine sized
integers for optimisations is nice, but using it as a default sucks,
especially since it's not that obvious that they are always faster:
64bit integers on 64bit CPU can be slower than 32bit integers due to the
increased memory&cache usage..
renoX
>
>
>> var_int, int_be32 (bigger or equal 32 bit), int_word: would be ok though.
>
> I'm assuming programmers won't use long windes type definitions if they can
> avoid it.
More information about the Digitalmars-d
mailing list