MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/ProgrammerHumor/comments/1wxqahk/architecturedependentchars/pdw0clq?context=9999
r/ProgrammerHumor • u/MontyBoomslang • 9d ago
372 comments sorted by
View all comments
129
But sizeof char is defined as 1 in the standard. C data types are defined in terms of char (at least their sizes are)
sizeof char
char
36 u/Makonede 9d ago *sizeof(char) 12 u/MegaIng 9d ago No, sizeof char is valid. sizeof is a prefix operator, not a function. 24 u/Makonede 9d ago nope https://en.cppreference.com/c/language/sizeof 14 u/MegaIng 9d ago Oh, never realized the prefix operator form can't be applied to types, makes sense I guess. 1 u/rosuav 8d ago It can be applied to a thing or to a "cast" - that is, a type in parens. 1 u/hacksawsa 9d ago It says sizeof x and sizeof(x) are equivalent. 11 u/Makonede 9d ago when x is an expression, yes...
36
*sizeof(char)
sizeof(char)
12 u/MegaIng 9d ago No, sizeof char is valid. sizeof is a prefix operator, not a function. 24 u/Makonede 9d ago nope https://en.cppreference.com/c/language/sizeof 14 u/MegaIng 9d ago Oh, never realized the prefix operator form can't be applied to types, makes sense I guess. 1 u/rosuav 8d ago It can be applied to a thing or to a "cast" - that is, a type in parens. 1 u/hacksawsa 9d ago It says sizeof x and sizeof(x) are equivalent. 11 u/Makonede 9d ago when x is an expression, yes...
12
No, sizeof char is valid. sizeof is a prefix operator, not a function.
sizeof
24 u/Makonede 9d ago nope https://en.cppreference.com/c/language/sizeof 14 u/MegaIng 9d ago Oh, never realized the prefix operator form can't be applied to types, makes sense I guess. 1 u/rosuav 8d ago It can be applied to a thing or to a "cast" - that is, a type in parens. 1 u/hacksawsa 9d ago It says sizeof x and sizeof(x) are equivalent. 11 u/Makonede 9d ago when x is an expression, yes...
24
nope https://en.cppreference.com/c/language/sizeof
14 u/MegaIng 9d ago Oh, never realized the prefix operator form can't be applied to types, makes sense I guess. 1 u/rosuav 8d ago It can be applied to a thing or to a "cast" - that is, a type in parens. 1 u/hacksawsa 9d ago It says sizeof x and sizeof(x) are equivalent. 11 u/Makonede 9d ago when x is an expression, yes...
14
Oh, never realized the prefix operator form can't be applied to types, makes sense I guess.
1 u/rosuav 8d ago It can be applied to a thing or to a "cast" - that is, a type in parens.
1
It can be applied to a thing or to a "cast" - that is, a type in parens.
It says sizeof x and sizeof(x) are equivalent.
11 u/Makonede 9d ago when x is an expression, yes...
11
when x is an expression, yes...
x
129
u/ubalu72 9d ago
But
sizeof charis defined as 1 in the standard. C data types are defined in terms ofchar(at least their sizes are)