Git Has a Variable Named false_but_the_compiler_does_not_know_it
blog.codingconfessions.com
blog.codingconfessions.com
In short, git has a 'create_ref_symlink' function that is replaced with a macro to '-1' on some build configurations. This means that any code which is conditioned on the success of create_ref_symlink would trigger a compiler warning when built with -Wunreachable-code. NOT_CONSTANT supresses this warning by preventing the compiler from realizing the code is unreachable. It also prevents the compiler from eliminating the dead code, but presumably that has only a negligable impact.
You could have just told us without that structure but that was exactly where an ad started. What a miraculous synchronicity!
Why couldn't:
> Today, in weird C code tricks, I want to show you a small example from Git’s source code.
> Recently, I was poking around the Git source when a directory name caught my eye, it was named “compiler-tricks”. I thought, “This is a promising name, let’s see what’s inside of it”.
> Inside this directory, there was a file called not-constant.c, and the whole file contained just this:
Have been:
> In the land of weird C code, there's an example in Git's not-constant.c:
The entire article is exhausting. So many "so why this" and "to understand this, x". Could have gotten the entire point across in perhaps 10% of the space.