Curl is C (2017)
I think something that is often missing in such posts is the appalling attitude towards undefined behavior in C compilers.<p>Yes, okay. You&#x27;ve been careful. You&#x27;ve checked you&#x27;re not accidentally overflowing a buffer, traced things with valgrind, all that good stuff.<p>None of that stops the compiler from doing random bullshit such as this in the search for better optimization:<p><a href="https:&#x2F;&#x2F;gcc.godbolt.org&#x2F;#{"version":3,"filterAsm":{"labels":true,"directives":true,"commentOnly":true},"compilers":[{"sourcez":"MQSwdgxgNgrgJgUwAQB4IGcAucogEYB8AUEZgJ4AOCiAZkuJkgBQBUAYjJJiAPZgCUTfgG4SWAIbcISDl15gkAER6iiEqfTCMAogCdx6BAEEoUIUgDeRJEl0JMMXQvRksCALZMARLvdIAtLp0APReIkQAviQAbjwgcEgAcgjRCLoAwuKm1OZWNspIALxIegbGpsI2kSQMSO7i4LnWtvaOCspCohFAA==","compiler":"/opt/clang+llvm-3.4.1-x86_64-unknown-ubuntu12.04/bin/clang++","options":"-Os -std=c++11 -Wall"}]}" rel="nofollow">https:&#x2F;&#x2F;gcc.godbolt.org&#x2F;#{"version":3,"filterAsm...</a><p>Personally, as a programmer I dread that sort of thing. I want code to work, not to try to figure out how a compiler could interpret my code in the most twisted way possible, like some sort of evil genie.<p>I think that&#x27;s one area where modern compilers are going wrong -- fine combing the spec for loopholes in the attempt to optimize better results in code being compiled into something nobody in their right mind would have intended.<p>Edit: For extra fun, try adding a std::cout to NeverCalled() -- it gets even more interesting.