Re:A semantic model for a substantial fragment of C
by laughinghan on Saturday April 01, 2017 @04:21PM
(#14013965)
> are there important projects that do this intentionally?
Expecting integer overflow to be two's complement is so common that successors like Java, Go, and Rust all standardized on it, used by hashing algorithms and more: https://github.com/rust-lang/rfcs/pull/560
> In any case, compiler authors are going to follow the C standards, not you hypothetical "C-in-practice" standards
"The optimizer does go to some effort to "do the right thing" when it is obvious what the programmer meant (such as code that does "* (int *)P" when P is a pointer to float)." --blogpost by the second most widely used C compiler, clang/llvm: http://blog.llvm.org/2011/05/what-every-c-programmer-should-...
Re:A semantic model for a substantial fragment of C
by greglindahl on Saturday April 01, 2017 @04:33PM
(#14014024)
Unsigned integers in C have defined wrap and that is what portable hash functions use.
Re:A semantic model for a substantial fragment of C
by naasking on Saturday April 01, 2017 @10:09AM
(#14012177)
> I don't agree with this. Yes, people often write code that unintentionally rely on UB/implementation-specific behavior; but are there important projects that do this intentionally?
The Linux kernel.
Re:A semantic model for a substantial fragment of C
by gravypod on Saturday April 01, 2017 @10:24AM
(#14012242)
I thought staging was the only folder with UB code.
I don't agree with this. Yes, people often write code that unintentionally rely on UB/implementation-specific behavior; but are there important projects that do this intentionally? In any case, compiler authors are going to follow the C standards, not you hypothetical "C-in-practice" standards, so what good does it do to for formalize or clearly specify the latter?