Like... is it 0
like in C++? Or is it some "special" object? Or maybe something totally different?
-- EDIT --
I do know what it is, the question is rather - how it's done
NULL is use as an abstraction because at the time it was not clear what the value of NULL would be from system to system. So the standard value is zero, Which is the same for '0'. Using NULL or '0' you are sure your code would work on any system regardless of what their values are.
A null value in a relational database is used when the value in a column is unknown or missing. A null is neither an empty string (for character or datetime data types) nor a zero value (for numeric data types).
The answer to that is rather simple: a NULL means that there is no value, we're looking at a blank/empty cell, and 0 means the value itself is 0. Considering there is a difference between NULL and 0, the way Tableau treats these two values therefore is different as well.
Definition of null (Entry 1 of 3) 1 : having no legal or binding force : invalid a null contract. 2 : amounting to nothing : nil the null uselessness of the wireless transmitter that lacks a receiving station— Fred Majdalany. 3 : having no value : insignificant … news as null as nothing …—
Since you're asking about implementation details, rather than semantics, the answer is specific to a given implementation.
There are three things in C# that "null" can be. A reference, a pointer, and a nullable type.
The implementation of C# on the CLR represents a null reference by zero bits. (Where the number of bits is the appropriate size to be a managed pointer on the particular version of the CLR that you're running.)
Unsurprisingly, a null pointer is represented the same way. You can demonstrate this in C# by making an unsafe block, making a null pointer to void, and then converting that to IntPtr, and then converting the IntPtr to int (or long, on 64 bit systems). Sure enough, you'll get zero.
A null nullable value type is also implemented by zeroes, though in a different way. When you say
int? j = null;
what we actually create is the moral equivalent of:
struct NullableInt
{
int value;
bool hasValue;
}
With appropriate accessor methods, and so on. When one of those things is assigned null, we just fill the whole thing with zero bits. The value is the integer zero, and the hasValue is filled with zeroes and therefore becomes false; a nullable type with the hasValue field set to false is considered to be null.
I do not know what the implementation details are on other implementations of C# / the CLI. I would be surprised if they were different; this is the obvious and sensible way to implement nulls. But if you have questions about a specific implementation detail, you'll have to ask someone who knows about the implementation you're interested in.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With