4 ms·
> sizeof(char) (== 1 almost everywhere) sizeof char is 1 by definition everywhere. /pedantic
by gpderetta 3y ago
> sizeof(char) (== 1 almost everywhere)
sizeof char is 1 by definition everywhere.
/pedantic
- shric 3y ago> sizeof char is 1 by definition everywhere. Parentheses are required around char because it's a type. /pedantic
- cjensen 3y agoThat is incorrect :-). sizeof is an operator in C, and does not need parenthesis any more than pointer operator *. It is true that programmers frequently think of it as a function and use parenthesis.
- teo_zero 3y agoIt's not that simple! To begin with, sizeof has two syntaxes: the first, which is the one you seem to refer to, is simply sizeof expression where expression involves variables and constants, not types. The second is sizeof (type) where the parentheses are mandatory. Then, even in the first syntax, even if sizeof is listed among the operators, even if it doesn't look any different from "pointer operator ", nonetheless it has strange priority rules. For example sizeof (T) *x If it was a regular prefix operator obeying priority and right-to-left evaluation, this would mean: dereference x, cast it to T, and return its size. Instead the C standard forces the compiler to interpret it as: take the size of type T and multiply it by x.
- shric 3y agoHilariously I've been down voted, even though you absolutely need sizeof (char) because it's a type. Given char x; sizeof x is fine. I know sizeof is an operator. I've been using C for 40 years.
- diath 3y agoThat's incorrect, from GCC: error: expected parentheses around type name in sizeof expression.
- lmm 3y agoIn the mathematical sense of almost, a property that holds everywhere does qualify as holding almost everywhere.
- deleted 3y ago[deleted]
- sargstuff 3y agoGuess can be taken as a shortened explaination of what a programming language committee is tasked with making happen. Likely why Lisp so successful/useful. ----- unless initial property is start of dynamic operation, in which case, holding almost anywhere begins at the first operation after the start of the dynamic operation. process / lambda / epsilon calculi is just symbolic math. address 0 static, everything else dynamic. per math, dimension N is static, to be able to "change things up" in dimension N, need to to be almost everywhere higher than dimension n. Edge cases are weird in any dimension. Guess why logicians just do the equivalent of C's !0 (cast classic logic) A=1 (cast boolean logic) B=0 C statement !(!B == A) hold everywhere and almost everywhere depends on how read C spec to interpret A & B.