To avoid some 32=>64 bit user code port bugs

Fawzi Mohamed fawzi at gmx.ch
Tue Aug 17 04:45:57 PDT 2010


On 17-ago-10, at 09:56, KennyTM~ wrote:

> On Aug 17, 10 05:34, Trass3r wrote:
>>> Or size_t and ptrdiff_t could be made to be built-in types. (?)
>>
>> There's no justification for that.
>> A proper way to define a strong typedef on the other hand is  
>> something
>> that is really needed.
>
> If size_t is a library-defined strong typedef instead of alias, what  
> type should .sizeof return?

I brought it up several times, I think that the following changes  
would limit very much 32 -> 64 bugs and unsigned related bugs:

1) typedef like dfinition of size_t, ptrdiff_t *but* with implicit  
conversion ptrdiff_t-> size_t (a normal typedef without implicit cast  
would be a pain to use)

2) implicit casts signed-> unsigned should be final in the sense that  
after an implicit cast to an unsigned type *no* other implicit casts  
should be allowed (the idea being that an implicit cast to unsigned  
commits to a given bit pattern because it is equivalent to working mod  
2**(8*T.sizeof)).

maybe this is the right time  for this to be re-considered?

Fawzi


More information about the Digitalmars-d mailing list