Can we just have struct inheritence already?
Ola Fosheim Grøstad
ola.fosheim.grostad at gmail.com
Thu Jun 13 09:48:20 UTC 2019
On Thursday, 13 June 2019 at 00:18:42 UTC, Timon Gehr wrote:
>> track allocated memory pointers. But that has nothing to do
>> with undefined values for integers.
>
> Undefined values are not undefined behavior.
Let's try to sort out the terminology, because it seems to cause
a lot of noise:
Integers don't have undefined values. An integer variable might
provide an arbitrary value, but it does not matter what it is if
you use an algorithm that always multiply by 0 in the first
iteration then assigns the variable a new value…
If the value was truly undefined, then it could cause undefined
behaviour, because then the hardware might not have a specified
consequence for its usage (so it could in theory vary between
different revisions of the CPU).
But undefined behaviour does not mean that anything can happen,
it just means that the spec does not say what will happen. The
hardware vendor or compiler implementor could make that
deterministic and explicit in the docs.
So, since C is meant to produce fast code for all kinds of
hardware you have "implementation defined", which means that
compiler implementors are required to define and document it.
Then you have "undefined", which means that the implementors are
not required to define and document it.
More information about the Digitalmars-d
mailing list