Shafik Yaghmour

Compiler Engineer at Intel. This is a personal blog. The opinions stated here are my own, not those of my company.

This is Just to Say for C++ Compilers

29 Nov 2018 » poetry, undefined behavior, C++, compilers

This Is Just to Say

I have translated
the program
that was in
the translation units

and which
you were probably
expecting
predictable results

Forgive me
they required no diagnostic
so undefined
and so erroneous


Inspired by This Is Just to Say

I originally wrote this around April 2nd 2018 and then tweeted it.

As I noted in the tweet almost all the replacement words came from the defintion of undefined behavior in the C++ standard:

undefined behavior
behavior for which this document imposes no requirements
[ Note: Undefined behavior may be expected when this document omits any explicit definition of behavior or when a program uses an erroneous construct or erroneous data. Permissible undefined behavior ranges from ignoring the situation completely with unpredictable results, to behaving during translation or program execution in a documented manner characteristic of the environment (with or without the issuance of a diagnostic message), to terminating a translation or execution (with the issuance of a diagnostic message). Many erroneous program constructs do not engender undefined behavior; they are required to be diagnosed. Evaluation of a constant expression never exhibits behavior explicitly specified as undefined in [intro] through [cpp] of this document ([expr.const]). — end note  ]