Article

From:
To:
Jacques Melancon
Subject:
Re: Cardinality of a set
Newsgroup:
borland.public.delphi.objectpascal

Re: Cardinality of a set

<<Jacques:
1. I know that there is no bit addressing
2. Both calls are identical in my example ( sizeof(TDigits) IS EQUAL TO 2 ).
    You need at least 2 bytes to store 10 "boolean" values.
>>

Sizeof() is not a function, Jacques, it's a compiler macro.
("Pseudo-function".) When you put it in, the executable simply has 2, or
whatever the right figure was. And that's the point -- don't trust your
calculations, trust sizeof(), the compiler knows for sure.

<<
3. My point was: Does the function need the number of bits to check (10)
    within the bytes received (2) or the number of bytes (2) used to stored
the set?
>>

Same answer. The Card function would be of little use if you had to make
sure, first, that you knew the last bit used for the set type. Sets can
begin on any value, not just 0; it's absurd to ask you to figure what
happens then. So, the function wants the byte count, and it wants it from
sizeof().

    PhR
FYI: Phrase searches are enclosed in either single or double quotes
 
 
Originally created by
Tamarack Associates
Tue, 26 Nov 2024 11:24:11 UTC
Copyright © 2009-2024
HREF Tools Corp.