On 16.07.2017 21:13, Florian Klaempfl wrote:
Indeed. This proves the exactly point. Undefined behaviour. The code
behaves randomly dependent on the compiler used and even the optimizer
switches.
OK, I see now: there is a difference between C enums and C++ enums. Your
example was about C++ enums. My example was about C enums. The C enums
are defined to allow any integer value, whereas C++ enums are strongly
typed.
C enums: https://msdn.microsoft.com/en-us/library/whbyts4t.aspx
https://www.gnu.org/software/gnu-c-manual/gnu-c-manual.pdf
C++ enums: https://msdn.microsoft.com/en-us/library/2dzy4k6e.aspx
I have to admit that Pascal enums are like C++ enums (strong typed) and
not like C enums. So yes, you are right.
Ondrej
_______________________________________________
fpc-devel maillist - fpc-devel@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel