> It would've been much more useful to make the move constructor of indirect be deleted No, that would be less useful. As-is, you can use a class with a `std::indirect<T>` member in a `std::vector` just fine, thanks to…
Are you forgetting about log4shell? log4shell was easier to exploit. It also come with an initial patch that turned out to be incomplete, so everyone had to urgently patch every java web app twice!
If a language allows taking references to fields within a tagged union (as is possible with Rust enums), then "shared-xor-mutable" is required to avoid use-after-free (switching the tagged union to another variant ends…
A surprising number of those optimizations are only valid by "reasoning from undefined behavior". Under the as-is rule, optimizations must not change program behavior. A C program could theoretically use out-of-bounds…
> I honestly don't really care how many optimizations that would break; correctness is king. It's approximately all optimizations. Good news: there's already a compiler option that does exactly what you want: -O0. It's…
The compiler is only allowed to do that when it can prove `puts` will return (i.e. it must prove `puts` does not call `exit`). In a world with SIGPIPE that shouldn't happen. (unless maybe the compiler can prove that…
Despite using C++ for a few years now, the EDG source code is still mostly C code (and in fact, the C++ code is still using the old .c file names). In particular, there's no usage of the C++ standard library. Where…
It's one of the 4 big remaining C++ compiler frontends: gcc, clang, MSVC, EDG. Most other C++ compilers are based on either EDG or clang. (e.g. the Intel C++ compiler used to be based on the EDG frontend, though modern…
> ILP64 (wherein int is 64 bits) exists. It's not very popular, but it exists; e.g. ICC supports it. ILP64 is problematic for existing code: there is lots of stuff like hashcode computations using uint32_t with…
For 32-bit floats, subnormals are the numbers closer to 0 than 2*(-126) == 0.0000000000000000000000000000000000000117549. For 64-bit doubles, it's 2*(-1022), a number starting with 308 decimal zeroes.
I don't know why I wrote the comment about parameters earlier -- (N)RVO is about return values. Those have a different reason for being passed behind a hidden pointer: the class type might have self-referencing…
> Memory safety bugs aren't any different from other bugs. This is highly dependent on what kind of software you are writing. On the one end, there's stuff like an image format parser in a browser -- a pure function…
The optimization is often possible even if the computer does not see the call, because most (all?) ABIs have always required hidden pointer parameters for class types with non-trivial destructors.…
The compiler cannot optimize that into `while(true)` because the original code does not encounter undefined behavior when `limit` is small enough to fit into `int`. What it can do: infer that `limit <= INT_MAX` and use…
The malicious code could use life-before-main hacks to gain code execution if it's linked at all, even if uncalled. https://grack.com/blog/2026/06/11/life-before-main/
$ORIGIN was only supported when the loader was looking for other dependencies. The loader itself (field PT_INTERP) is loaded by the kernel. So prior to this change, every program must hardcode the absolute path to…
> Furthermore parsing JSON or YAML gives you the basic data types like lists and dictionaries. Parsing XML gives you an AST that requires a lot more effort to turn into data in your domain. More precisely: in XML,…
`rmdir /s /q` in a command prompt is significantly faster than Windows Explorer. Yes C: is slow due to filters and Dev Drive is faster; but this difference can only be felt when using the command line; Windows Explorer…
In our compiler (in a code analysis tool), we have #pragma immutable_macro __attribute__ After this pragma, any attempt to #define/#undef the macro "__attribute__" will be silently ignored. This lets us (or our…
It's a normal command called "View: Reopen Closed Editor".
Yes `int` acts as if it was a subtype of `float`: https://typing.python.org/en/latest/spec/special-types.html#...
But in Python the type checker does not complain about `x: float = 0`, because for the purpose of type checking (but not at runtime), `int` is considered a subtype of `float`:…
In most languages, `x: float = 0` involves an implicit conversion from int to float. In Python, type annotations have no impact on runtime behavior, so even though the type checker accepts this code, `type(x)` will be…
Don't forget the compatibility issues: Fil-C isn't really usable if you mix C with other languages in the process. It's especially problematic to have multiple different garbage collectors; so given the desire to reuse…
When accessing individual elements, 0-based and 1-based indexing are basically equally usable (up to personal preference). But this changes for other operations! For example, consider how to specify the index of where…
> It would've been much more useful to make the move constructor of indirect be deleted No, that would be less useful. As-is, you can use a class with a `std::indirect<T>` member in a `std::vector` just fine, thanks to…
Are you forgetting about log4shell? log4shell was easier to exploit. It also come with an initial patch that turned out to be incomplete, so everyone had to urgently patch every java web app twice!
If a language allows taking references to fields within a tagged union (as is possible with Rust enums), then "shared-xor-mutable" is required to avoid use-after-free (switching the tagged union to another variant ends…
A surprising number of those optimizations are only valid by "reasoning from undefined behavior". Under the as-is rule, optimizations must not change program behavior. A C program could theoretically use out-of-bounds…
> I honestly don't really care how many optimizations that would break; correctness is king. It's approximately all optimizations. Good news: there's already a compiler option that does exactly what you want: -O0. It's…
The compiler is only allowed to do that when it can prove `puts` will return (i.e. it must prove `puts` does not call `exit`). In a world with SIGPIPE that shouldn't happen. (unless maybe the compiler can prove that…
Despite using C++ for a few years now, the EDG source code is still mostly C code (and in fact, the C++ code is still using the old .c file names). In particular, there's no usage of the C++ standard library. Where…
It's one of the 4 big remaining C++ compiler frontends: gcc, clang, MSVC, EDG. Most other C++ compilers are based on either EDG or clang. (e.g. the Intel C++ compiler used to be based on the EDG frontend, though modern…
> ILP64 (wherein int is 64 bits) exists. It's not very popular, but it exists; e.g. ICC supports it. ILP64 is problematic for existing code: there is lots of stuff like hashcode computations using uint32_t with…
For 32-bit floats, subnormals are the numbers closer to 0 than 2*(-126) == 0.0000000000000000000000000000000000000117549. For 64-bit doubles, it's 2*(-1022), a number starting with 308 decimal zeroes.
I don't know why I wrote the comment about parameters earlier -- (N)RVO is about return values. Those have a different reason for being passed behind a hidden pointer: the class type might have self-referencing…
> Memory safety bugs aren't any different from other bugs. This is highly dependent on what kind of software you are writing. On the one end, there's stuff like an image format parser in a browser -- a pure function…
The optimization is often possible even if the computer does not see the call, because most (all?) ABIs have always required hidden pointer parameters for class types with non-trivial destructors.…
The compiler cannot optimize that into `while(true)` because the original code does not encounter undefined behavior when `limit` is small enough to fit into `int`. What it can do: infer that `limit <= INT_MAX` and use…
The malicious code could use life-before-main hacks to gain code execution if it's linked at all, even if uncalled. https://grack.com/blog/2026/06/11/life-before-main/
$ORIGIN was only supported when the loader was looking for other dependencies. The loader itself (field PT_INTERP) is loaded by the kernel. So prior to this change, every program must hardcode the absolute path to…
> Furthermore parsing JSON or YAML gives you the basic data types like lists and dictionaries. Parsing XML gives you an AST that requires a lot more effort to turn into data in your domain. More precisely: in XML,…
`rmdir /s /q` in a command prompt is significantly faster than Windows Explorer. Yes C: is slow due to filters and Dev Drive is faster; but this difference can only be felt when using the command line; Windows Explorer…
In our compiler (in a code analysis tool), we have #pragma immutable_macro __attribute__ After this pragma, any attempt to #define/#undef the macro "__attribute__" will be silently ignored. This lets us (or our…
It's a normal command called "View: Reopen Closed Editor".
Yes `int` acts as if it was a subtype of `float`: https://typing.python.org/en/latest/spec/special-types.html#...
But in Python the type checker does not complain about `x: float = 0`, because for the purpose of type checking (but not at runtime), `int` is considered a subtype of `float`:…
In most languages, `x: float = 0` involves an implicit conversion from int to float. In Python, type annotations have no impact on runtime behavior, so even though the type checker accepts this code, `type(x)` will be…
Don't forget the compatibility issues: Fil-C isn't really usable if you mix C with other languages in the process. It's especially problematic to have multiple different garbage collectors; so given the desire to reuse…
When accessing individual elements, 0-based and 1-based indexing are basically equally usable (up to personal preference). But this changes for other operations! For example, consider how to specify the index of where…