Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Null for value type variables

2 views
Skip to first unread message

Sam Kong

unread,
Oct 7, 2003, 8:51:44 PM10/7/03
to
Hello!

I'm a newbie to PB.
I've been programming with C++, Delphi.

In those languages, null has a meaning only with pointer types (reference types).
(I'm not talking about null character.)
Actually null pointer is stored as a special value (usually 0).

In database, null values is stored as flags out of the column instead of values.
Thus, it's different than programming data.

In PB, value types can be a null (for db interaction purpose).
I am wondering how the null value exists in the memory.

For instance,

integer i // i occupies 2 bytes in memory
i = 0 // in memory, 0x0000 is stored.
SetNull(i) // what is in the memory? What is the bit representation for null?

I don't think that pure 2 byte memory can hold a special value for null.
An integer can be -32768 to +32767 (2^16 different cases),
which means that all possible cases with 2 bytes are already taken.

Then, how does PB handle null for value types?
Is an integer actaully structure with flags
or is it an reference pointing to an actual integer?

Can somebody enlighten me?

TIA.

Sam

0 new messages