<div dir="auto"><div><div class="gmail_quote"><div dir="ltr">Dmitry Boyarintsev <<a href="mailto:skalogryz.lists@gmail.com">skalogryz.lists@gmail.com</a>> schrieb am Fr., 12. Okt. 2018, 22:55:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div dir="ltr"><div class="gmail_quote"><div dir="ltr">On Fri, Oct 12, 2018 at 3:51 PM Sven Barth via fpc-devel <<a href="mailto:fpc-devel@lists.freepascal.org" target="_blank" rel="noreferrer">fpc-devel@lists.freepascal.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">All the Pascal Boolean types are not "Integer types". You can't assign<br>
any of them to a Integer or whatever without typecasting. They *all*<br>
behave like Boolean, because that was the way they were added. They are<br>
all 1-bit zero extended to the specified size.</blockquote><div>It's true for pascal sources, but the issue is not with pascal, but rather interfacing C-world (where before C99 boolean didn't quite exist).</div><div>And the whole family of boolean types (if the documentation can be trusted) was introduced for this whole purpose.</div></div></div></div></blockquote></div></div><div dir="auto"><br></div><div dir="auto">Not quite: the Boolean16, Boolean32 and Boolean64 types were introduced because the libraries provided by GTK required a 4-Byte boolean type that worked like Object Pascal's Boolean. Until then only Boolean and the *Bool types existed (and in Delphi that is still true). And Boolean exists this way because it existed this way in Turbo Pascal. </div><div dir="auto"><br></div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div dir="ltr"><div class="gmail_quote"><div><br></div><div>Documentation itself lays out pretty structured and consistent layout:</div><div>BooleanX - indicates a boolean of a size N-bits, and if the value is requested, it would be translated to either 0 or 1.<br></div><div>NNNNBool - indicates a boolean of a sizeof(NNNN), and if the value is requested, it can be anything that is non zero.</div><div><br></div><div>But since the documentation is wrong, I believe there's no consistency, and everything is pretty much target dependent. (and it's sad).<br></div></div></div></div></blockquote></div></div><div dir="auto"><br></div><div dir="auto">It's not target dependent, it works the same on all platforms that FPC supports. </div><div dir="auto"><br></div><div dir="auto">Also the documentation is now going to be revised as the meaning should have been that these Boolean types are *ordinals* not *integers*. </div><div dir="auto"><br></div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div dir="ltr"><div class="gmail_quote"><div></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Now for the problem at hand the question is either if the ABI is<br>
implemented incorrectly or that a new kind of Boolean type is required<br>
to correctly represent the _Bool type needed by Objective C.<br></blockquote><div>I do not believe that it is Objective-C specific issue. <br></div><div>Declared BOOL macro can be used in a plain C-function call and would have the exact side effect.</div><div>(Apple puts it a special consideration <a href="https://developer.apple.com/documentation/objectivec/bool" target="_blank" rel="noreferrer">https://developer.apple.com/documentation/objectivec/bool</a>)</div></div></div></div></blockquote></div></div><div dir="auto"><br></div><div dir="auto">Then maybe it's an issue about the ABI (maybe all values with a size < 4 need to be correctly extended due to the ABI). </div><div dir="auto"><br></div><div dir="auto">Regards, </div><div dir="auto">Sven </div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
</blockquote></div></div></div>