Rendered at 09:57:17 GMT+0000 (Coordinated Universal Time) with Cloudflare Workers.
hyperhello 19 hours ago [-]
> To answer that, we need to look at where this macro is actually used.
You could have just told us without that structure but that was exactly where an ad started. What a miraculous synchronicity!
goodmythical 17 hours ago [-]
I always hate when authors waffle around instead of just getting to it.
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.
hyperhello 17 hours ago [-]
It's the televisionization of the Internet. You should imagine it as a guy walking down a beach as the camera follows him looking sincerely and speaking to alleviate your loneliness and then there will be a shampoo ad!
goodmythical 13 hours ago [-]
That reminds me of an old project that I want to say was called "methbusters" that was a recut of the original mythbusters in which they cut all of the repetitions that came after every commercial break. Final product was something like 5 minutes an episode.
hyperhello 8 hours ago [-]
That's hilarious. Also check out some youtubes where they edit the laugh track out of sitcoms and they're just staring at each other between unjokes.
lostmsu 20 hours ago [-]
The article stops short of actually telling why would anyone need NOT_CONSTANT
gizmo686 19 hours ago [-]
Keep reading beyond the ad...
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.
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.