From the standard, C11, 6.5.3.4 The sizeof and _Alignof operators:
5 The value of the result of both operators is implementation-defined, and its type (an
unsigned integer type) is size_t, defined in (and other headers).
So, the sizeof operator yields an unsigned value. You then compare an unsigned value with a signed value. That is dealt with by converting the signed value to be unsigned, which explains the behaviour that you see.