size_t + ptrdiff_t
newshound2 at digitalmars.com
Tue Feb 21 18:23:00 PST 2012
On 2/21/2012 12:33 AM, Manu wrote:
> On 21 February 2012 01:22, Walter Bright <newshound2 at digitalmars.com
> <mailto:newshound2 at digitalmars.com>> wrote:
> On 2/20/2012 3:28 AM, Manu wrote:
> Even size_t is often
> broken in C. I have worked on 64bit systems with 32bit pointers where
> size_t was
> still 64bit, but ptrdiff_t was 32bit (I think PS3 is like this, but maybe my
> memory fails me)
> I don't know how that could be considered C standard compliant.
> I don't know about you, but I very rarely get to work with a C compiler that is
> 'standards compliant'.. that concept is kinda like a cruel joke in my
> experience. Does one even exist? :)
The C99 Standard sez:
"The types are ptrdiff_t which is the signed integer type of the result of
subtracting two pointers; size_t which is the unsigned integer type of the
result of the sizeof operator;"
I don't know of any excuse for getting this wrong.
More information about the Digitalmars-d