|
|
|
|
|
by dathinab
681 days ago
|
|
But C never had been portable assembly. Which I think is somewhat the core of the problem. People treating things in C in ways they just are not. Weather that is C is portable assembly or C the "it's just bit's in memory" view of things (which often is double wrong ignoring stuff like hardware caching). Or stuff like writing const time code based on assuming that the compiler probably, hopefully can't figure out that it can optimize something. > The real argument seems to be that C compilers had it right when they really did embody C as portable assembly But why would you use such a C. Such a C would be slow compared to it's competition while still prone to problematic bugs. At the same time often people seem to forgot that part of UB is rooted in different hardware doing different things including having behavior in some cases which isn't just a register/mem address having an "arbitrary value" but more similar to C UB (like e.g. when it involves CPU caches). |
|
The ANSI C standards committee disagrees with you.
"Committee did not want to force programmers into writing portably, to preclude the use of C as a “high-level assembler:”
https://www.open-std.org/JTC1/SC22/WG14/www/docs/n897.pdf
p 2, line 39. (p10 of the PDF)
"C code can be portable. "
line 30