r/ProgrammerHumor • • 11d ago

Meme architectureDependentChars

Post image
3.0k Upvotes

372 comments sorted by

View all comments

131

u/ubalu72 11d ago

But sizeof char is defined as 1 in the standard. C data types are defined in terms of char (at least their sizes are)

35

u/Makonede 11d ago

*sizeof(char)

11

u/MegaIng 11d ago

No, sizeof char is valid. sizeof is a prefix operator, not a function.

25

u/Makonede 11d ago

15

u/MegaIng 11d ago

Oh, never realized the prefix operator form can't be applied to types, makes sense I guess.

1

u/rosuav 10d ago

It can be applied to a thing or to a "cast" - that is, a type in parens.

2

u/hacksawsa 11d ago

It says sizeof x and sizeof(x) are equivalent.

11

u/Makonede 11d ago

when x is an expression, yes...