<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 Sa., 13. Okt. 2018, 01:57:<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 dir="ltr"><div dir="ltr"><div dir="ltr"><div class="gmail_quote"><div dir="ltr">On Fri, Oct 12, 2018 at 6:48 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"><div dir="auto"><div><div class="gmail_quote"><div dir="ltr">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.<br></div></div></div></div></blockquote><div>That's interesting.</div><div>Let me ask a couple of things here:</div><div><br></div><div>1) gboolean is a size of int (<a href="https://www.gtk.org/api/2.6/glib/glib-Basic-Types.html#gboolean" target="_blank" rel="noreferrer">https://www.gtk.org/api/2.6/glib/glib-Basic-Types.html#gboolean</a>)</div><div>where FALSE is 0 and TRUE is not FALSE.<br></div><div><a href="https://www.gtk.org/api/2.6/glib/glib-Standard-Macros.html#TRUE:CAPS" target="_blank" rel="noreferrer">https://www.gtk.org/api/2.6/glib/glib-Standard-Macros.html#TRUE:CAPS</a><br></div><div>so, it's more -1, rather than 1 and it doesn't quite maps to Boolean and/or Boolean32. It's matches to LongBool.</div><div><br></div><div><div>var</div><div> b : Boolean;</div><div> lb : LongBool;</div><div> b32 : Boolean32;</div><div>begin</div><div> b := true;</div><div> lb := true;</div><div> b32 := true;</div><div> writeln(byte(b),' ',LongWord(b32),' ',LongWord(lb));</div><div> writeln(ord(b),' ',Ord(b32),' ',Ord(lb));</div><div>end.</div></div><div>Results in:</div><div><div>1 1 4294967295</div><div>1 1 -1</div></div><div>(matches documentation)</div></div></div></div></div></div></div></blockquote></div></div><div dir="auto"><br></div><div dir="auto">This was the reason they were added: <a href="https://bugs.freepascal.org/view.php?id=17400">https://bugs.freepascal.org/view.php?id=17400</a></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 dir="ltr"><div dir="ltr"><div dir="ltr"><div class="gmail_quote"><div><br></div><div>2) why the were they named booleanN rather than gtkboolean or something? (I'm referring to the suggestion of using objcbool name. It seem to fit)</div></div></div></div></div></div></div></blockquote></div></div><div dir="auto"><br></div><div dir="auto">They're an extension of the existing Boolean type with merely a different size, so why should they be named any differently? (in addition to what Michael wrote) </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 dir="ltr"><div dir="ltr"><div dir="ltr"><div class="gmail_quote"><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="auto"><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></blockquote><div><br></div><div>I think Jonas clearly stated that ABI call works properly (to the word of the specification)</div><div>The issues is that BOOL in objective-C is for Intel (macOS) is not _Bool but rather a signed char.</div><div><br></div><div>As of today, Pascal doesn't provide Boolean type that behaves like a signed char in ABI terms.</div><div>(Boolean, and Boolean8 are size of _Bool which matched the size of signed char, though treated are passed as "_Bool" following ABI rules)</div></div></div></div></div></div></div></blockquote></div></div><div dir="auto"><br></div><div dir="auto">Then maybe the type used to represent that BOOL should be a "type char" alias instead of using one of the build in Boolean types. </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>