frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open in hackernews

System.LongBool

https://docwiki.embarcadero.com/Libraries/Sydney/en/System.LongBool
31•surprisetalk•4d ago

Comments

azhenley•2h ago
I need some context… why?
dale_glass•2h ago
It says it right there:

"Note: The ByteBool, WordBool, and LongBool types exist to provide compatibility with other languages and operating system libraries."

beyondCritics•2h ago
Turns out that old versions of Visual C++ used their own typedef of bool as int: https://stackoverflow.com/questions/4897844/is-sizeofbool-de...
bobmcnamara•2h ago
There were risc platforms with int sized bool, usually where one byte math wasn't in the instruction set.
bobmcnamara•2h ago
In C, sizeof(bool) is implementation specific. Typical values are sizeof(char) and sizeof(int).
keketi•1h ago
In case you need a lot more than two boolean values some day.
knodi123•2h ago
I chuckled, but presumably it's useful for applications where you want data types to take up the same amount of space, like for matrices or database columns? Or maybe where you coerce different data types into boolean? The language offers WordBool and ByteBool too, so they're pretty consistent. And AFAIK, there aren't any languages where you can specifically allocate only a single bit for a single boolean.
nneonneo•2h ago
You kind of can in C with bit size specifications on struct members, but you’ll still face the problem that C’s minimum alignment is one byte - so a struct containing a single 1-bit field will still occupy a byte in memory. However, it does let you “allocate” different bits within a byte for different member fields.

C++ has vector<bool>, which is supposed to be an efficient bit-packed vector of Booleans, but due to C++ constraints it doesn’t quite behave like a container (unlike other vector<T>s). Of course, if you make a vector<bool> of a single bit, that’s still going to occupy much more than one bit in memory.

There are plenty of hardware specification languages where it’s trivial to “allocate” one bit, but those aren’t allocating from the heap in a traditional sense. (Simulators for these languages will often efficiently pack the bits in memory, but that’s more of an implementation detail than a language guarantee).

kevincox•2h ago
> Note: The ByteBool, WordBool, and LongBool types exist to provide compatibility with other languages and operating system libraries.

Which makes sense. So these are really only intended to be used for FFI, not internal Delphi code. If you are bridging from C where bools are a byte you want to determine how you handle the other values.

I think the one thing missing is specifying what the True and False constants map to. It is implied that False maps to 0 by "A WordBool value is considered False when its ordinality is 0" but it doesn't suggest that True has a predictable value which would be important for FFI use cases.

stefs•2h ago
I'm not sure I get you - "not 0" is a more predicable value than a certain number, isn't it?
kevincox•2h ago
I'm talking about output. For sure, if I am reading this bool from FFI I want to have "not 0" be truthy. However if I am writing a bool to a FFI interface I want the value to be predictable (for example 1) rather than "some non-zero value".

Although this does open interesting cases where if you read a bool from one FFI interface and write to another it may have an unexpected value (ex 2). But I still think it is useful for the in-language conversions for example Boolean to LongBool and the True constant to have predictable values.

saurik•2h ago
I presume this FFI goes in both directions; some APIs really want the value of a boolean to be 1 while others really want it to be "all 1s"/0xfff.../-1 because, internally, someone decided to do something silly and compare == or switch on TRUE.
masfuerte•1h ago
The .Net runtime generates code that relies on bools being either 0 or 1. It's quite easy using interop to inadvertently set a bool to something else and this leads to very odd bugs where simple boolean expressions appear to be giving the wrong result.

(Tangentially, VB traditionally used -1 for true. VB.NET uses the same 0 or 1 internal representation for a bool as C# but if you convert a bool to a number in VB.NET it comes out as -1.)

da_chicken•21m ago
-1 isn't even a bad choice, since that's basically using 0xFF for true and 0x00 for false. The weirdness is the fact that you're converting a binary value to a signed integer.
Sharlin•2h ago
And bools are definitely a byte only on "new" C standard versions (as in since C99), before that there was no boolean type and ints were often used. Thus, LongBool.
1313ed01•2h ago
Also in Free Pascal?

https://wiki.freepascal.org/Data_type#Boolean_types

nine_k•2h ago
This reply was wrong, removed.

Please downvote it to oblivion.

p_l•2h ago
Every major CPU ISA still in use can, in fact, address individual bytes (C and C++ standards even demand atomic access).

It's just inefficient, but sometimes needed (MMIO, inter-cpu visible byte changes, etc)

jonathrg•1h ago
You can just make stuff up on this website
noir_lord•2h ago
Amazes me that Embarcadero/Delphi is still going - it's been 25ish years since I wrote a line of Object Pascal, it was a very nice language in its day with an even nicer IDE.
MarkSweep•1h ago
I assume this type is for compatibility with the 32-bit BOOL type on Windows. This is a common bugaboo when doing interoperability, as I think languages tend to define bool as a 8-bit value.

https://learn.microsoft.com/en-us/windows/win32/winprog/wind...

This must be a pretty slow news day for this to make the front page of Hacker News.

mastax•1h ago
Don’t they use int-size bools in Solaris? I think I remember seeing those in ZFS.
spyrja•1h ago
Next up: 64-bit booleans for the win!

Microsoft 365 Copilot – Arbitrary Data Exfiltration via Mermaid Diagrams

https://www.adamlogue.com/microsoft-365-copilot-arbitrary-data-exfiltration-via-mermaid-diagrams-...
35•gnabgib•1h ago•6 comments

Show HN: MyraOS – My 32-bit operating system in C and ASM (Hack Club project)

https://github.com/dvir-biton/MyraOS
79•dvirbt•4h ago•8 comments

Are-we-fast-yet implementations in Oberon, C++, C, Pascal, Micron and Luon

https://github.com/rochus-keller/Are-we-fast-yet
22•luismedel•1h ago•1 comments

A definition of AGI

https://arxiv.org/abs/2510.18212
119•pegasus•6h ago•193 comments

NORAD’s Cheyenne Mountain Combat Center, c.1966

https://flashbak.com/norad-cheyenne-mountain-combat-center-478804/
76•zdw•5d ago•37 comments

Ken Thompson recalls Unix's rowdy, lock-picking origins

https://thenewstack.io/ken-thompson-recalls-unixs-rowdy-lock-picking-origins/
60•dxs•7h ago•2 comments

AI Mafia Network – An interactive visualization

https://dipakwani.com/ai-mafia/
62•dipakwani•1h ago•6 comments

A bug that taught me more about PyTorch than years of using it

https://elanapearl.github.io/blog/2025/the-bug-that-taught-me-pytorch/
320•bblcla•3d ago•65 comments

System.LongBool

https://docwiki.embarcadero.com/Libraries/Sydney/en/System.LongBool
31•surprisetalk•4d ago•23 comments

Poison, Poison Everywhere

https://loeber.substack.com/p/29-poison-poison-everywhere
64•dividendpayee•2h ago•24 comments

Show HN: Helium Browser for Android with extensions support, based on Vanadium

https://github.com/jqssun/android-helium-browser
17•jqssun•2h ago•1 comments

Wren: A classy little scripting language

https://wren.io/
110•Lyngbakr•4d ago•30 comments

Sandhill Cranes Have Adopted a Canada Gosling

https://www.smithsonianmag.com/science-nature/these-sandhill-cranes-have-adopted-a-canadian-gosli...
5•NaOH•4d ago•1 comments

Making the Electron Microscope

https://www.asimov.press/p/electron-microscope
54•mailyk•7h ago•6 comments

Asbestosis

https://diamondgeezer.blogspot.com/2025/10/asbestosis.html
211•zeristor•16h ago•155 comments

Feed the bots

https://maurycyz.com/misc/the_cost_of_trash/
138•chmaynard•12h ago•102 comments

Alzheimer's disrupts circadian rhythms of plaque-clearing brain cells

https://medicine.washu.edu/news/alzheimers-disrupts-circadian-rhythms-of-plaque-clearing-brain-ce...
139•gmays•7h ago•25 comments

Eavesdropping on Internal Networks via Unencrypted Satellites

https://satcom.sysnet.ucsd.edu/
172•Bogdanp•6d ago•28 comments

Downloadable movie posters from the 40s, 50s, 60s, and 70s

https://hrc.contentdm.oclc.org/digital/collection/p15878coll84/search
400•bookofjoe•1w ago•79 comments

Pico-Banana-400k

https://github.com/apple/pico-banana-400k
351•dvrp•22h ago•60 comments

Researchers demonstrate centimetre-level positioning using smartwatches

https://www.otago.ac.nz/news/newsroom/researchers-demonstrate-centimetre-level-positioning-using-...
11•geox•6d ago•2 comments

Formal Reasoning [pdf]

https://cs.ru.nl/~freek/courses/fr-2025/public/fr.pdf
116•Thom2503•12h ago•26 comments

Resource use matters, but material footprints are a poor way to measure it

https://ourworldindata.org/material-footprint-limitations
9•surprisetalk•10h ago•1 comments

Validating your ideas on strangers (2017)

https://jeremyaboyd.com/post/validating-your-ideas-on-strangers
58•tacon•2d ago•31 comments

Nvidia DGX Spark: When benchmark numbers meet production reality

https://publish.obsidian.md/aixplore/Practical+Applications/dgx-lab-benchmarks-vs-reality-day-4
124•RyeCatcher•6h ago•79 comments

Why your social.org files can have millions of lines without performance issues

https://en.andros.dev/blog/4e12225f/why-your-socialorg-files-can-have-millions-of-lines-without-a...
78•andros•1d ago•6 comments

Advent of Code 2025: Number of puzzles reduce from 25 to 12 for the first time

https://adventofcode.com/2025/about#faq_num_days
405•vismit2000•16h ago•197 comments

Writing a RISC-V Emulator in Rust

https://book.rvemu.app/
99•signa11•17h ago•40 comments

You already have a Git server

https://maurycyz.com/misc/easy_git/
378•chmaynard•13h ago•309 comments

Clojure Land – Discover open-source Clojure libraries and frameworks

https://clojure.land/
157•TheWiggles•16h ago•38 comments