@@ -123,3 +123,19 @@ gcc's printf attribute directive in the prototype.
This makes it so gcc's -Wformat and -Wformat-security options can do
their jobs and cross-check format strings with the number and types
+6. Implementation defined and undefined behaviours
+The C language specification defines regions of undefined behaviour and
+implementation defined behaviour (to give compiler authors enough
+leeway to produce better code). In general, code in QEMU should
+follow the language specification and avoid both undefined and
+implementation defined constructs. ("It works fine on the gcc
+I tested it with" is not a valid argument...) However there are
+a few areas where we allow ourselves to assume certain behaviours
+because in practice all the platforms we care about behave in the
+same way and writing strictly conformant code would be painful.
+ * you may assume that integers are 2s complement representation
+ * you may assume that right shift of a signed integer duplicates
+ the sign bit (ie it is an arithmetic shift, not a logical shift)