It was in v6 (and a nasty bug):
   /*
     * sizeof gets turned into a number here.
     * Bug: sizeof(structure-member-array) is 2 because
     * the array has been turned into a ptr already.
     */
    if (op==SIZEOF) {
        t1 = length(p1);
        p1->op = CON;
        p1->type = INT;
        p1->dimp = 0;
        p1->value = t1;
        *cp++ = p1;
        return;
    }

but in v7 (without the bug):
    /*
     * sizeof gets turned into a number here.
     */
    if (op==SIZEOF) {
        t1 = cblock(length(p1));
        t1->type = UNSIGN;
        *cp++ = t1;
        return;
    }

It's not surprising, since "unsigned" didn't originally exist (use "char*"!)

On 22 November 2012 11:36, Richard Miller <[email protected]> wrote:
>> New C programmers are often confused by
>> size_t being unsigned (even experienced ones at times)
>
> Especially experienced ones.  My 1978 copy of K&R says
>
> "The expression sizeof(object) yields an integer equal to the
> size of the specified object."
>
> Not "unsigned integer".  Old habits die hard.
>
>

Reply via email to