3 ms·
> What does the expression SCHAR_MAX == CHAR_MAX evaluate to? > Sorry about that -- I didn't give you enough information to answer this one. The signedness o
by MauranKilom 4y ago
> What does the expression SCHAR_MAX == CHAR_MAX evaluate to?
> Sorry about that -- I didn't give you enough information to answer this one. The signedness of the char type is implementation-defined
...why not have an "implementation-defined" answer button then, because that's what people should know (instead of knowing all ABIs) and what the question is about anyway?
> If these operators were right-associative, the expression [x - 1 + 1] would be defined for all values of x.
That's just wrong, no? If + and - were right-associative, it would be parsed as x - (1 + 1), which is decidedly not "defined for all values of x".
- shultays 4y agoI raised an eyebrow on that as well, in some questions you have implentation defined for an answer so I assumed the author just wrongly assumed undefined covers that
- necovek 4y agoOther questions might also be "implementation defined", thus a caveat to assume GCC/LLVM implementations on x86/amd64 at the start. I.e. C standard enforces undefined very sparingly iirc, and most of the corner cases are implementation defined. I may also be misremembering things: it's been 20 years since I've carefully read C99 (draft, really) for fun :))
- kevin_thibedeau 4y agoEven the compiler assumption isn't enough. There is also an implicit assumption in the answers that x86-64 is using LP64 when some platforms will use LLP64 (Windows) or ILP64 (Cray).
- Lockal 4y agoThe answer for question about SCHAR_MAX == CHAR_MAX is just wrong there. Of course it is "undefined", or actually, it is configurable with "-funsigned-char" flag (for GCC/Clang/ICC). https://godbolt.org/z/PTEoW91v5 https://godbolt.org/z/PTEoW91v5