Forum > General

TBits constructor

<< < (3/3)

Zvoni:

--- Quote from: PascalDragon on February 07, 2023, 09:06:06 pm ---
--- Quote from: Zvoni on February 07, 2023, 03:02:31 pm ---additionally, what escapes me is the usage of a signed Integer for that.
--- End quote ---

Pascal essentially always favors signed types to unsigned ones: Length() returns SizeInt, Count returns LongInt and so on.

--- End quote ---
But that’s „historical“, right?
Common sense says we’re wasting away a whole range.

Ah, well…

dseligo:

--- Quote from: Zvoni on February 08, 2023, 07:27:34 am ---
--- Quote from: PascalDragon on February 07, 2023, 09:06:06 pm ---
--- Quote from: Zvoni on February 07, 2023, 03:02:31 pm ---additionally, what escapes me is the usage of a signed Integer for that.
--- End quote ---

Pascal essentially always favors signed types to unsigned ones: Length() returns SizeInt, Count returns LongInt and so on.

--- End quote ---
But that’s „historical“, right?
Common sense says we’re wasting away a whole range.

Ah, well…

--- End quote ---

In the context of bits, we are wasting only one. You have 63 left (98,4%) :)

Zvoni:

--- Quote from: dseligo on February 08, 2023, 08:16:21 am ---In the context of bits, we are wasting only one. You have 63 left (98,4%) :)

--- End quote ---
Yeah, in that particular case, but my comment was more in "general" (like Length, Count etc.)

Warfley:
When we are talking about 64 bits this does not matter that much, because Sizes are heavily linked to pointer differences and sizes greater than maxptr - minptr don't make much sense.
And I am not aware of any OS that uses the whole 64 bit address range, I think the limit for both windows and Linux today is 48 bit.
So the sign bit does not matter. And it can have some advantages as you can additional Information using the sign, e.g. errors

PascalDragon:

--- Quote from: Zvoni on February 08, 2023, 07:27:34 am ---
--- Quote from: PascalDragon on February 07, 2023, 09:06:06 pm ---
--- Quote from: Zvoni on February 07, 2023, 03:02:31 pm ---additionally, what escapes me is the usage of a signed Integer for that.
--- End quote ---

Pascal essentially always favors signed types to unsigned ones: Length() returns SizeInt, Count returns LongInt and so on.

--- End quote ---
But that’s „historical“, right?
--- End quote ---

No, it's not historical, because the compiler by default calculates with signed integers and thus internally there is even a hidden 128-bit signed integer type, because it's required to correcty handle certain combinations of the 64-bit unsigned types.


--- Quote from: Warfley on February 08, 2023, 11:06:20 am ---And I am not aware of any OS that uses the whole 64 bit address range, I think the limit for both windows and Linux today is 48 bit.

--- End quote ---

That's also because the processors don't provide more (both x86_64 and ARM64 have MMU related registers that describe the size of the address space and right now both have 48-bit).

Navigation

[0] Message Index

[*] Previous page

Go to full version