> 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.

Surprisingly, cherry-picked examples to prove a point are cherry-picked examples to prove a point.

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.

> the accidental part is that you suddenly made your build non-reproducible

But 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.

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 of

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.

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.

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.