|
And here I might've supposed you'd want people talking less about things they have no concept of.
What's really important is the ability to dictate to the apple that it is inferior, and they mostly left that out altogether.
lol
|
|
|
|
|
jochance wrote: What's really important is the ability to dictate to the apple that it is inferior, and they mostly left that out altogether. That makes no sense at all.
Pears are superior tough
Bastard Programmer from Hell
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
Zero and null are not remotely the same thing. Zero is a value like any other. Null is the absence of any value, "undefined" if you like.
|
|
|
|
|
In C zero and NULL are very much the same thing.
|
|
|
|
|
And so is the color black (assuming an RGB color space).
Or anything else represented as binary zeroes in your favorite computer architecture. That two values of completely different semantics have identical same internal representations doesn't imply that the two values are "very much the same thing" - if you just overlook the type/class information.
In an OO world, any object instance, regardless of class, having a single member which is set to some value represented as all bits reset is also very much the same thing as a numeric zero. Or a null pointer. If you ignore its semantics, the way you do to claim that zero and null are very much the same thing.
|
|
|
|
|
What I actually said was
Quote: In C zero and NULL are very much the same thing. Not that zero and null are the same everywhere.
|
|
|
|
|
We're both right. You're referring to an implementation, I was referring to the concept, the abstraction if you like, where null represents "value unknown" (or "not yet defined").
|
|
|
|
|
Exactly why I prefaced my remark "In C", to make it clear that I was talking about a specific situation.
|
|
|
|
|
In JavaScript, undefined and null are two distinct values. The former meaning not defined and the latter meaning no value. Different concepts completely.
Jeremy Falcon
|
|
|
|
|
Education.
And yes, lack of is a common problem.
Bastard Programmer from Hell
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
Addresses of other addresses boggles the mind; until you get the hang of it.
"Before entering on an understanding, I have meditated for a long time, and have foreseen what might happen. It is not genius which reveals to me suddenly, secretly, what I have to say or to do in a circumstance unexpected by other people; it is reflection, it is meditation." - Napoleon I
|
|
|
|
|
Give freedom back to 'NULL' to exist.
If not: Dear c# designers, please then remove the possibility to define nullable types
|
|
|
|
|
The problems are not about nullable types. Thay are about ordinary references being null.
|
|
|
|
|
There is a bridge joining the two buildings in our location. Any "developer" whose code crashes in production because of a bad pointer gets hanged from the bridge pour encourager les autres.
So no, this is not a common problem.
Seriously, all the developers I work with (even the young 'uns) know what a null reference is, and know to avoid it
Freedom is the freedom to say that two plus two make four. If that is granted, all else follows.
-- 6079 Smith W.
modified 5-Mar-23 12:05pm.
|
|
|
|
|
Quote: Seriously, all the developers I work with (even the young 'uns) know what a null reference is, and know to avoid it
Same here. All the young serious developers I'm working with, know how to handle it.
|
|
|
|
|
0x01AA wrote: Same here.
Here too.
"If we don't change direction, we'll end up where we're going"
|
|
|
|
|
Richard MacCutchan wrote: Do those of you who still work in teams find this is a common problem with younger team members?
Yes, all the time. I almost think it is something you have to learn the hard way, because in my experience, most are not aware of this as they code.
Now, new IntelliSense with VS 2022 and ReSharper will point this out/alert you right away when it happens, but still, everyone should grok this concept.
|
|
|
|
|
A guy on the team I just joined was somewhat miffed about the whole nullable feature in C#. He had learned in university that object oriented languages had nullable references. And C# is an object oriented language... so obviously we could not force references to have values.
|
|
|
|
|
Richard, this is a problem of perception, you seem to think anyone who posts in Q&A is a "developer". Most are probably just learning (and you are their teaching resource) and a lot of them are code monkeys at best.
Never underestimate the power of human stupidity -
RAH
I'm old. I know stuff - JSOP
|
|
|
|
|
trønderen has also said it well.
Even the C language has confusion on this topic.
Yes, I too believe that they have distinct meanings.
Remember my posing the question of why is this a valid statement in C
zero = 0;
value = malloc( zero );
value is not null nor zero.
Why would I want to allocate zero memory?
Here is what ChatAI says
In the C programming language, calling malloc(0) is allowed and returns a pointer to a memory block of size 0. This is specified in the C standard, which states that malloc(0) is equivalent to malloc(1).
The reason for this behavior is that malloc is intended to allocate memory dynamically, and a request for 0 bytes of memory is considered a valid request. Allocating a block of memory with a size of 0 can be useful in certain situations, such as when you want to create a zero-length array or when you want to allocate memory that you will later reallocate to a different size using realloc.
However, it is important to note that malloc does not guarantee that it will return a pointer to a block of memory that is truly 0 bytes in size. The implementation of malloc may choose to return a block of memory that is larger than the requested size, in which case the additional memory will not be accessible to your program.
Clear as mud.
"A little time, a little trouble, your better day"
Badfinger
|
|
|
|
|
Forgive my ignorance, but what is the point or purpose of a zero length array?
Or at the lower level, reserving zero memory space?
|
|
|
|
|
To declare that it is known, but has a zero length value.
E.g. if my middle name is a zero length string, null, it is known that I have no middle name. If it is null, I may have a middle name not yet entered into the database.
|
|
|
|
|
exactly.
0 means zero in contrast to 1 .. NULL means void or does not exist.
However, this subtlety gets blurred by the programming and programmers making use of it.
In C, Null is meant to be void address. zero is number 0.
But if I do a boolean test on either one, I get false.
If you print them they are both zero.
Hence the blurriness.
They are equivalent at programming level yet we know they mean two different things.
Maybe C++ handles it differently.
Go figure
"A little time, a little trouble, your better day"
Badfinger
modified 6-Mar-23 23:05pm.
|
|
|
|
|
Excellent topic.
"A little time, a little trouble, your better day"
Badfinger
|
|
|
|
|
It seems to me not only null is the problem, but programming knowledge in general.
Throughout my career I've seen very bad code by very "experienced" people.
Not just the young kids, but the old farts too.
It's so bad I'm now convinced that about 90% of the people are just plain bad at their job
|
|
|
|