6/18/2026 at 3:02:39 PM
> There are a shocking number of ways to accidentally create nondeterministic output when doing C/C++ development. One of the easiest is to use the builtin __DATE__ and __TIME__ macros to stamp a build with the time the compiler was executed at:Am I missing something here? Yes, if you use a feature that intentionally inserts the build time and date into the code, the every build is going to be different. That's the whole point of these macros. It's a feature. If you don't want that behavior, don't use that feature.
by lisper
6/18/2026 at 8:27:01 PM
"One of the easiest"It's meant to be a trivial counterexample. Like saying "-1" to the claim "there's no number smaller than 0" to someone who's not familiar with math, the author is saying "build-dependent macros" to the claim "compilers are deterministic" to someone who might not be familiar with compilers.
by yapfrog
6/18/2026 at 10:51:44 PM
A trivial counterexample to what? The antecedent of "one of the easiest" was "ways to accidentally create nondeterministic output." One even the most charitable reading I can muster that still seems to me to presume some pretty abject stupidity.by lisper
6/19/2026 at 2:35:27 AM
A trivial counter example to the intuition one might have that compilers likely produce deterministic output. It’s directly responsive to the exchange between Aoi and Numa above, wherein Aoi expresses exactly that intuition. Of course, those are characters playing out a question less familiar readers might ask. Presumably the intent is to make this content accessible to a wider audience, using an obvious example to introduce the concept without requiring much background knowledge.by eyelidlessness
6/18/2026 at 3:03:35 PM
Surprisingly, cherry-picked examples to prove a point are cherry-picked examples to prove a point.by xena
6/18/2026 at 3:55:17 PM
I think the intentional part is that you want to print the date and time something's been compiled, and the accidental part is that you suddenly made your build non-reproducible.But usually the realization follows the initial intent by several weeks, if not months! Your comment shines as the embodiment of hindsight is 20/20.
by fasterthanlime
6/18/2026 at 4:22:27 PM
> the accidental part is that you suddenly made your build non-reproducibleBut that's exactly what I don't get. How can that be considered "accidental"? How can any thinking person not realize that putting the build time into the compiled image will make every build different because, you know, different builds happen at different times? Has software engineering really been dumbed down so much that this is not immediately obvious? It feels like a mechanic doing an oil change and being surprised by having all the oil drain out if they neglect to put the drain plug back in.
by lisper
6/18/2026 at 5:01:40 PM
With you on this especially because somebody I know asked me to help change their oil and they hadn't even considered there being waste oil to dispose ofby Neywiny
6/18/2026 at 5:11:31 PM
The engineer who wants the build to be reproducible and the engineer who wants to have the build time in the compiled binary may not be the same person.by NobodyNada
6/18/2026 at 5:28:46 PM
Sure, but that is a completely different issue. People have mutually-conflicting goals on occasion. That is a Thing That Happens, but it is a very different phenomenon than being surprised by the obvious fact that putting a time stamp on your build makes that build non-reproducible.by lisper
6/19/2026 at 9:49:40 AM
Usually, the person making the decision to add this is not in the same company or even the same time–space continuum as the victim of it.In a parallel non–Euclidean dimension, perpetrators go the other way and have their victims build with -j1 reproducible builds.
by avadodin
6/19/2026 at 12:05:03 PM
-j1 doesn't make builds any more or less reproducible.by account42
6/18/2026 at 5:31:06 PM
I don't think these kind of features belong in a compiler. If you want a stamp then pass it in to your compiler invocation via explicit defines.You might accidentally end up including it transitively and suddenly your binary is nondeterministic.
by eddd-ddde