3 ms·
If you're steeped in C and its quirks, have good coding patterns that allow for it, I say knock yourself out. I'm absolutely coding in C again — writing some o
by JKCalhoun 4y ago
If you're steeped in C and its quirks, have good coding patterns that allow for it, I say knock yourself out.
I'm absolutely coding in C again — writing some old-school games using SDL. After working for decades with various retain/release, garbage-collected, magic-memory™ languages, going back to C feels like programming again. I like it.
- lmm 4y ago> If you're steeped in C and its quirks, have good coding patterns that allow for it, I say knock yourself out. Somewhere between 95% and 100% of people who think they're "steeped in C and its quirks, have good coding patterns that allow for it" write code that invokes undefined behaviour.
- otabdeveloper4 4y agoThere's nothing wrong with undefined behaviour.
- preseinger 4y agoUndefined behavior means the language provides no guarantees about the outcome. Whatever happens is up to the compiler, or rather the specific implementation of the compiler, and the target architecture on which the program is run. These things are not constrained by any spec or guarantee, so they are allowed to change, for any reason, to anything. These changes may be triggered by not only different execution environments, but also changes to properties of a given execution environment. The behavior of a program with undefined behavior is non-deterministic, and cannot be predicted, modeled, or effectively maintained.
- otabdeveloper4 4y ago> Undefined behavior means the language provides no guarantees about the outcome. No, not "the language", but "the standard". Languages like Python or Rust that don't have standards are 100 percent undefined behavior. If you're really worried about this, then just code against x86_64 clang and not ISO C++ and forget about this non-problem forever.
- preseinger 4y agos/language/language as defined by the specification that also defines the concept of undefined behavior/
- otabdeveloper4 4y agoLike I said, Rust and Python have no specification at all, so technically any program written in them is undefined behavior, depending on the particular interpreter/compiler binaries you use and your architecture.
- preseinger 4y agoundefined behavior is not the absence of a spec, it's a specific condition that specs define