<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Wed, Aug 23, 2017 at 3:50 AM, Florian Klämpfl <span dir="ltr"><<a href="mailto:florian@freepascal.org" target="_blank">florian@freepascal.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span class="gmail-">Am 22.08.2017 um 15:59 schrieb Martok:<br>> As a heads-up: whatever tool you end up using, make sure you do NOT translate<br>
> the C enums in mpfr.h as enumerations. It will work, but create unpredictable<br>
> codegen on the FPC side.<br>
<br>
</span>It is perfectly predictable. Just do not store invalid values in enumeration variables. And invalid<br>
is everything not being declared. This is how FPC works and will work.</blockquote><div><br></div><div>Never saw FPC acting unpredictably.</div><div>(There was an issue back in the days with Delphi. But it's only because delphi packs enumerations to 1 byte, where FPC packs them to 4 bytes in objfpc mode)</div><div><br></div><div>Instead, I saw C-enumarations used as non-Pascal-enumerations. (which is actually expected C<>Pascal).</div><div><br></div><div>For instance, it's common for C enumerations to be used used in bitwise operations.</div><div>ENUM1 | ENUM2 </div><div>(but report for sdl2 headers <a href="https://github.com/ev1313/Pascal-SDL-2-Headers/issues/44">https://github.com/ev1313/Pascal-SDL-2-Headers/issues/44</a>)</div><div>not available in Pascal, unless an explicit type casting or sets are used.</div><div><br></div><div>So, in the end it's better to declare enumeration type elements as constant</div><div>and the type itself as an alias to integer (or cint)</div><div><br></div><div>thanks,</div><div>Dmitry</div></div></div></div>