Bookstore

Recent

Author Topic: Is there a "bitness dependent" boolean type in FPC ?  (Read 739 times)

Thaddy

  • Hero Member
  • *****
  • Posts: 9784
Re: Is there a "bitness dependent" boolean type in FPC ?
« Reply #15 on: February 20, 2020, 10:48:55 am »
So my example is not so weird after all? I still think it is wacky... 8-)
I am more like donkey than shrek

440bx

  • Hero Member
  • *****
  • Posts: 1558
Re: Is there a "bitness dependent" boolean type in FPC ?
« Reply #16 on: February 20, 2020, 11:03:07 am »
Since 3.0 true and false are not keywords anymore
Looks like the reason was Delphi compatibility.  I don't care much for that kind of "flexibility".  It opens the open the door to all kinds of rather surprising situations because someone decided to flip the meaning of true and false.   Got to love it.  Other than having a potential to create headaches, it seems to be totally useless.


Be sure to use LongBool and QWordBool then. Using Boolean32 and Boolean64 would lead to trouble in your context sooner or later.

Declaring your own alias is the solution. PtrInt and PtrUInt are declared like that as well, so there is nothing inherently wrong with that.
Ultimately, I wasn't satisfied with any of the options. I figured another way of getting the stuff done without having to inspect the contents the data structure, that way the function can return a real Boolean.

However, thank you for the good advice, I appreciate it.


using FPC v3.0.4 and Lazarus 1.8.2 on Windows 7 64bit.

Thaddy

  • Hero Member
  • *****
  • Posts: 9784
Re: Is there a "bitness dependent" boolean type in FPC ?
« Reply #17 on: February 20, 2020, 11:29:53 am »
it seems to be totally useless.
Except in your case? 8-)
I am more like donkey than shrek

440bx

  • Hero Member
  • *****
  • Posts: 1558
Re: Is there a "bitness dependent" boolean type in FPC ?
« Reply #18 on: February 20, 2020, 11:36:08 am »
it seems to be totally useless.
Except in your case? 8-)
When I find myself doing stuff like that, that's when I know I have to rethink the method.  It's useful for that. :)
using FPC v3.0.4 and Lazarus 1.8.2 on Windows 7 64bit.

Thaddy

  • Hero Member
  • *****
  • Posts: 9784
Re: Is there a "bitness dependent" boolean type in FPC ?
« Reply #19 on: February 20, 2020, 11:54:32 am »
When I find myself doing stuff like that, that's when I know I have to rethink the method.  It's useful for that. :)
That's called C programming.... :D Anyway, what you asked is possible within the confines of the language.  O:-)
Recommended? of course not!

But then again, you yourself referred to C style languages, so why not accept the solutions while you embrace the C solution? Which is by accident and not by design... An oversight that became a feature.
C is a rather incomplete language, I dare say frivolous, even gratuit, There is something wrong with your reasoning.... :P :'( O:-)
« Last Edit: February 21, 2020, 11:12:40 am by Thaddy »
I am more like donkey than shrek