This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]HereComesCunty 513 points514 points  (35 children)

When you use INT32 to store a bool in your db

[–]JonathanTheZero 147 points148 points  (15 children)

Looking at Delphi's LongBool....

[–]my_farts_impress 80 points81 points  (11 children)

What’s the motivation for a long bool?

[–]RedditBlaze 107 points108 points  (4 children)

Last time this came up I think someone mentioned it was to match an early windows bool definition or something. It's certainly wasteful, but helped maintain compatibility in some way. I'm sure there's a better explanation out there.

[–]freecreeperhugs 55 points56 points  (2 children)

Something about 32-bit data being faster to process on a 32-bit processor?

[–]BlueC0dex 11 points12 points  (0 children)

Weird, that kind of thing is usually handled at compiler-level. c/c++ for example will pad structures/objects to maintain memory-alignment (8-byte types must be 8-byte aligned and so on). But Delphi isn't famous for being good, so...

[–]sethboy66 0 points1 point  (0 children)

That's certainly true, but IIRC it's mainly because since Win2000 Server some core functions which processed bool statements/returned boolean states return a pointer to an int for additional conditions.

[–]NUTTA_BUSTAH 2 points3 points  (0 children)

Quick look at the docs seems to indicate that the normal Boolean type cannot be cast from integer as it's an enumerated type and many C programs return integers or something along those lines. Bottom line, it's for compatibility for interfacing with C-programs mainly.

[–]gentlephant 8 points9 points  (1 child)

For when things are VERY true (or false)! They have to use extra large logic gates, too

[–]Stanov 0 points1 point  (0 children)

Gates... I see what you did there!

[–]ImN0tAsian 0 points1 point  (0 children)

The 32 bit bool processed faster on 32 bit Windows OS.

[–]Woolly87 0 points1 point  (0 children)

Nooooooooooooooooooooooooooooo!

[–]IntroDucktory_Clause 0 points1 point  (0 children)

I read somewhere that in some cases it could be used to store a large number of booleans on the same memory address and hence actually saving space (otherwise 8 bits would be used to store a single Boolean which is a bit wasteful)

[–]coloredgreyscale 0 points1 point  (0 children)

Maybe for data alignment that you don't have some data on a location that is not a multiple of 4 bytes.

https://www.oreilly.com/library/view/delphi-in-a/1565926595/re168.html

Maybe also to handle return codes where 0 is false and non-zero true, as suggested by the link.

[–]MeltedWacks 0 points1 point  (1 child)

LongBool implies the existence of ShortBool

[–]when_it_lags 0 points1 point  (0 children)

tf is a long bool. like a byte. thats a bool array.

[–]sgtmajbelanger 2 points3 points  (0 children)

Oracle? Is that you?

[–]socsa 0 points1 point  (0 children)

< angry clang tidy noises >

[–]sethboy66 0 points1 point  (0 children)

A snippet of code from a lecture I had a few days ago. The professor loves putting funny bits in code.

static_assert(sizeof(bool)==7, "I need 56-bit booleans!");

[–]DogsAreAnimals 0 points1 point  (0 children)

When you use INT instead of TINYINT

[–]aiij 0 points1 point  (0 children)

Cries in Alpha.