Jun 4, 2017 9:06 PM
Ryeore
117242
2062
82
Mephane
It's the year 2017. Use nullptr, not NULL.
amc21101
Unless it's Pointer
Tyler58
Am programmer can confirm
l009
0, null and blank. My team never fully king gets it. Same with boolean, only store false if null means something!
SterlingArcherSecretAgent
Love it :-)
oldpotatoes
Idk programming but I think I get it
yournextpapercut
Just started learning programming and I do sort of understand :D
PleaseAllowMeToPlayDevilsAdvocate
Isnull(tp,'')
octavarious
WHAT ABOUT N/A?
AlexisWalker
Also NaN
Aedr
I'm not a programmer and I still got it. :\
Fwords
There are 10 types of people in the world...those who understand binary and those who don't.
BlueDucktape
I'm not a programmer and i understand. Not sure why though
Austin5624
That resonates more than thirty minutes worth of office hours with !y programming 1 professor
tomattow
It's a trap, I mean switch
Tk842
So when I used to say between 0 and none, there was actually something between them.
SaxonBulkav2
For people who don't understand. When computers see 0 they only see it as a value, null tells the computer there is nothing there
13andido
oh shit!
UserNameCorrupted
Meanwhile, I'm trying to explain how much better this type of toilet paper dispenser is. Japan over engineers everything.
DeleteAccountant
I'm not a programmer but I still understand it, does that make me smarter than all programmers?
ShowMeYourButtonhole
It means you are logical. Congrats! Coding is just a logical way of expressing statements.
DownvotesAreFun
There is many other things you need when coding. Patience, planning and dedication are all important too. E.g. I always forget semicolons.
Now you're talking about software construction as a whole. Avoid languages with semicolons.
ShowmeOne
thank god im ....bi-polae
TeammateAssist
I don't get it.
0nceUponAMidnightDreary
While 0 and "null" are basically the same outside of logic (empty), 0 is still "something". Like an empty tp roll vs nothing at all.
mammageek
I totally couldn't even tell they were TP rolls.
kernell32
Like, 0 is you've run out of X and null is you didn't even had X to begin with?
TheSwedishCryptid
not really, 0 is a numerical value of X. Null is X doesn't have a value what so ever.
FLORlDAMAN
Stupid programming joke that isn't funny.
Anthraxwastaken
Just because you say "only programers understand" that doesn't make it funny
BlackPengu
Fuck you and opinion
ajstl89
public void SenseOfHumor() { throw new NotImplementedException();}
TheotherAgentJohnson
Zero means none of something. Null means there is no something.
GlitterInTheDarkNearTheTannhauserGate
what about undefined
Klhumnpgooier
Zero just non and o takes a full alphabet
Rowee
So an empty cup vs no cup?
RogueKitsune
Depends on language. Some, yes. Others, knowing there is no cup vs not knowing where to find a cup, trying anyway, and grabbing "something"
EvilDeadTed
Yes.
darthOnion
Memory allocated, no value assigned?
Null is a constant. Null is null is null.
TheLordofMelons
Depends.
Beepity
?
CaptainObviouslikesthemthicc
14 years after C++ now i get it
[deleted]
sadavocado
You are a very slow learner
FrozenTime
It's important to know the difference, but you can get by without knowing why (1+1 = 2: doesn't really matter if you don't understand why)
Thanks internet stranger.
Loftskip
This is the the worst lie anyone has ever told.
DerpMeister
It's more complicated. Imagine you try to grab the toilet paper and instead you grab a random item in your household while someone (...)
Llording
Mm, depends on the language. For C that's perfect, for Java less so. Either way you're gonna have a bad time.
True. I gave lessons in C when I was working at the university.
AquaCrusher
It's true in the context of having toilet paper available for not I think?
Dereferencing a null-pointer doesn't yield a random bit of memory. It's an instant access violation (i.e. crash).
Sveniat
what would an uninitialized toilet paper roll look like?
(...) bangs against the door and yells that your not allowed to touch that.
Moghul
You're
TheBlindFreak
And a majority of people won't understand just how perfect this analogy is.
zillian
Going by upvotes there's at least a few XD
I just finished a course using C not too long along... yeah, this is perfect. :D
LerkNJerk
There are 10 kinds of people in this world, those who understand binary and those who don't.
dev89
There are 2 kinds of people, those who can extrapolate from incomplete data.
y2kboris1
Brilliant Android sheerly brilliant (and I know sheerly isn't really a word but it's soo win).
IFoldlyGo
There are three kinds of people. Those who can count and those who can't
GregorSamsa
I never got why this isn't saying there's 3 types of people 0, 1, 10.
Nicely done!
iouoneusername
0 is still 0 in binary.
At least I think it is
But in a list the third item is 2
Yes, but that's because the first item is item index 0. It's waste of memory not to use 0 as an index.
So.... 0, 1, 10 is 3 items... if those items are people who understand binary are there not then 3 of them?
obamalamadingdongditch
If(!$tp){panic()}
Nalianna
@TheDisco
pinkiesmalls
Haha
fhatpotatou
Else{wipe()}
Groose
As a c++ programmer no semi colon hurts
MrRandomUK
As somebody who only is self taught in basic... errrrrr.
PiGuy314
As a programmer, using PHP hurts in general.
ILikeTheWayYourWormShits
As a Java programmer, same.
itsimpossibletofindausernamethatisnttaken
nah man, just gotta keep a cool head. if(!$tp){usesock()}
ShouldersDeepInAHorse
Totally (I don't)-[know$any+thing]-Insert: Anything value: About-((Programming))
aethoneagle
kalatix
jQuery FTW
TurdlyShitkens
jQuery isn't even a language.
That's not jQuery. It looks like PHP.
danishjuggler21
Dollar sign says PHP, but lack of semicolon excludes that. Python?
immorecreativethanmyusernameletson
Looks like php to me. Source: I develop in php
tonebacas
Not any Python that I've ever seen. I'm not even sure Python allows for variables with dollar sign in their name. Javascript, however, does.
Powershell, then? @128k what's your syntax?
TrueWhiteAfrican
I am pretty sure that it is jQuery
Also known to non-javascript devs as a heaping pile of nope.
ItsJoshProbably
You are not syntactically required to punctuate a statement that immediately precedes a curly-bracket.
Edit: Actually, I'm full of shit. I must be confusing this with JavaScript, where it's entirely optional, but I don't neglect them anyways.
lol I recently had a debate with a coworker about JavaScript and doing away with semicolons - I'm firmly against ditching them :-p
That's like arguing to get rid of periods. Unless you're using Python where that is the defined syntax it's preposterous.
Really? I seem to recall getting errors for missing semicolons in PHP. I haven't done PHP in quite a while, though, so I may be mistaken.
I tried it out and I'm wrong. I'd never be that lazy, but I swear I've seen it done. It may be a php.ini setting.
DocVolt
That's the best way to explain it
samsonguy920
I can also smell it from here.
usingYourMomAsAHat
!false. Its funny because its true.
PapaMagic
This was on my computer science club shirts... Its cringy af
PoopholeAintALoophole
I'm going to use this in future tutorials I give. Well played indeed. Although, its really not concept I find folks struggle with.
Like say recursive functions and such.
DrJayAllTheWay
You know, it really is
4chansdboard
If needExplanation(){ explain(well); };
stormegedendarklordofall
I don't understand... Could you explain?
sandybuttcheeks
0 is an integer, null means there is no value whatsoever.
AlfredoTheMagnificent
I think 0 = empty and null = nothing.
Declaring a variable as 0 is something, it literally takes up a space of memory, null is nothing. There's nothing there to use up memory.
0 = Value that's 0, aka the number. Null = nothing what so ever.
It's like "Air vs Vaccum"
stavesacre
But...but...an int isn't a nullable type. Oh, ok fine, I'll allow it.
if it's javascript it doesn't matter
Tom40
In databases all types allow null
Ah, yeah, good point
it could be an int*? Wait no that just makes them both null...
That's why nullptr is the better choice. int* x = nullptr is clearer than int* x = 0
nullptr is still 0x00000000, but you're right that nullptr should always be used over the NULL macro (as long as your compiler supports it).
I guess the bit on the NULL macro is microsoft compiler specific, im not as familiar with the linux c++ world.
ToiletPaper.Count = 0. Empty list vs uninitialized list ????
Yeah but an empty object is different than "0". That's probably the closest thing though
Mephane
It's the year 2017. Use nullptr, not NULL.
amc21101
Unless it's Pointer
Tyler58
Am programmer can confirm
l009
0, null and blank. My team never fully king gets it. Same with boolean, only store false if null means something!
SterlingArcherSecretAgent
Love it :-)
oldpotatoes
Idk programming but I think I get it
yournextpapercut
Just started learning programming and I do sort of understand :D
PleaseAllowMeToPlayDevilsAdvocate
Isnull(tp,'')
octavarious
WHAT ABOUT N/A?
AlexisWalker
Also NaN
Aedr
I'm not a programmer and I still got it. :\
Fwords
There are 10 types of people in the world...those who understand binary and those who don't.
BlueDucktape
I'm not a programmer and i understand. Not sure why though
Austin5624
That resonates more than thirty minutes worth of office hours with !y programming 1 professor
tomattow
It's a trap, I mean switch
Tk842
So when I used to say between 0 and none, there was actually something between them.
SaxonBulkav2
For people who don't understand. When computers see 0 they only see it as a value, null tells the computer there is nothing there
13andido
oh shit!
UserNameCorrupted
Meanwhile, I'm trying to explain how much better this type of toilet paper dispenser is. Japan over engineers everything.
DeleteAccountant
I'm not a programmer but I still understand it, does that make me smarter than all programmers?
ShowMeYourButtonhole
It means you are logical. Congrats! Coding is just a logical way of expressing statements.
DownvotesAreFun
There is many other things you need when coding. Patience, planning and dedication are all important too. E.g. I always forget semicolons.
ShowMeYourButtonhole
Now you're talking about software construction as a whole. Avoid languages with semicolons.
ShowmeOne
thank god im ....bi-polae
TeammateAssist
I don't get it.
0nceUponAMidnightDreary
While 0 and "null" are basically the same outside of logic (empty), 0 is still "something". Like an empty tp roll vs nothing at all.
mammageek
I totally couldn't even tell they were TP rolls.
kernell32
Like, 0 is you've run out of X and null is you didn't even had X to begin with?
TheSwedishCryptid
not really, 0 is a numerical value of X. Null is X doesn't have a value what so ever.
FLORlDAMAN
Stupid programming joke that isn't funny.
Anthraxwastaken
Just because you say "only programers understand" that doesn't make it funny
BlackPengu
Fuck you and opinion
ajstl89
public void SenseOfHumor() { throw new NotImplementedException();}
TheotherAgentJohnson
Zero means none of something. Null means there is no something.
GlitterInTheDarkNearTheTannhauserGate
what about undefined
Klhumnpgooier
Zero just non and o takes a full alphabet
Rowee
So an empty cup vs no cup?
RogueKitsune
Depends on language. Some, yes. Others, knowing there is no cup vs not knowing where to find a cup, trying anyway, and grabbing "something"
EvilDeadTed
Yes.
darthOnion
Memory allocated, no value assigned?
ShowMeYourButtonhole
Null is a constant. Null is null is null.
TheLordofMelons
Depends.
Beepity
CaptainObviouslikesthemthicc
14 years after C++ now i get it
[deleted]
[deleted]
sadavocado
You are a very slow learner
FrozenTime
It's important to know the difference, but you can get by without knowing why (1+1 = 2: doesn't really matter if you don't understand why)
CaptainObviouslikesthemthicc
Thanks internet stranger.
Loftskip
This is the the worst lie anyone has ever told.
DerpMeister
It's more complicated. Imagine you try to grab the toilet paper and instead you grab a random item in your household while someone (...)
Llording
Mm, depends on the language. For C that's perfect, for Java less so. Either way you're gonna have a bad time.
DerpMeister
True. I gave lessons in C when I was working at the university.
AquaCrusher
It's true in the context of having toilet paper available for not I think?
Mephane
Dereferencing a null-pointer doesn't yield a random bit of memory. It's an instant access violation (i.e. crash).
Sveniat
what would an uninitialized toilet paper roll look like?
DerpMeister
(...) bangs against the door and yells that your not allowed to touch that.
Moghul
You're
TheBlindFreak
And a majority of people won't understand just how perfect this analogy is.
zillian
Going by upvotes there's at least a few XD
RogueKitsune
I just finished a course using C not too long along... yeah, this is perfect. :D
LerkNJerk
There are 10 kinds of people in this world, those who understand binary and those who don't.
dev89
There are 2 kinds of people, those who can extrapolate from incomplete data.
y2kboris1
Brilliant Android sheerly brilliant (and I know sheerly isn't really a word but it's soo win).
IFoldlyGo
There are three kinds of people. Those who can count and those who can't
GregorSamsa
I never got why this isn't saying there's 3 types of people 0, 1, 10.
LerkNJerk
Nicely done!
iouoneusername
0 is still 0 in binary.
GregorSamsa
At least I think it is
GregorSamsa
But in a list the third item is 2
iouoneusername
Yes, but that's because the first item is item index 0. It's waste of memory not to use 0 as an index.
GregorSamsa
So.... 0, 1, 10 is 3 items... if those items are people who understand binary are there not then 3 of them?
obamalamadingdongditch
If(!$tp){panic()}
Nalianna
@TheDisco
pinkiesmalls
Haha
fhatpotatou
Else{wipe()}
Groose
As a c++ programmer no semi colon hurts
MrRandomUK
As somebody who only is self taught in basic... errrrrr.
PiGuy314
As a programmer, using PHP hurts in general.
ILikeTheWayYourWormShits
As a Java programmer, same.
itsimpossibletofindausernamethatisnttaken
nah man, just gotta keep a cool head. if(!$tp){usesock()}
ShouldersDeepInAHorse
Totally (I don't)-[know$any+thing]-Insert: Anything value: About-((Programming))
aethoneagle
kalatix
jQuery FTW
TurdlyShitkens
jQuery isn't even a language.
PiGuy314
That's not jQuery. It looks like PHP.
danishjuggler21
Dollar sign says PHP, but lack of semicolon excludes that. Python?
immorecreativethanmyusernameletson
Looks like php to me. Source: I develop in php
tonebacas
Not any Python that I've ever seen. I'm not even sure Python allows for variables with dollar sign in their name. Javascript, however, does.
danishjuggler21
Powershell, then? @128k what's your syntax?
TrueWhiteAfrican
I am pretty sure that it is jQuery
ILikeTheWayYourWormShits
Also known to non-javascript devs as a heaping pile of nope.
ItsJoshProbably
You are not syntactically required to punctuate a statement that immediately precedes a curly-bracket.
ItsJoshProbably
Edit: Actually, I'm full of shit. I must be confusing this with JavaScript, where it's entirely optional, but I don't neglect them anyways.
danishjuggler21
lol I recently had a debate with a coworker about JavaScript and doing away with semicolons - I'm firmly against ditching them :-p
ItsJoshProbably
That's like arguing to get rid of periods. Unless you're using Python where that is the defined syntax it's preposterous.
danishjuggler21
Really? I seem to recall getting errors for missing semicolons in PHP. I haven't done PHP in quite a while, though, so I may be mistaken.
ItsJoshProbably
I tried it out and I'm wrong. I'd never be that lazy, but I swear I've seen it done. It may be a php.ini setting.
DocVolt
That's the best way to explain it
samsonguy920
I can also smell it from here.
usingYourMomAsAHat
!false. Its funny because its true.
PapaMagic
This was on my computer science club shirts... Its cringy af
PoopholeAintALoophole
I'm going to use this in future tutorials I give. Well played indeed. Although, its really not concept I find folks struggle with.
PoopholeAintALoophole
Like say recursive functions and such.
DrJayAllTheWay
You know, it really is
4chansdboard
If needExplanation(){ explain(well); };
stormegedendarklordofall
I don't understand... Could you explain?
sandybuttcheeks
0 is an integer, null means there is no value whatsoever.
AlfredoTheMagnificent
I think 0 = empty and null = nothing.
Groose
Declaring a variable as 0 is something, it literally takes up a space of memory, null is nothing. There's nothing there to use up memory.
TheSwedishCryptid
0 = Value that's 0, aka the number. Null = nothing what so ever.
TheSwedishCryptid
It's like "Air vs Vaccum"
[deleted]
[deleted]
[deleted]
[deleted]
stavesacre
But...but...an int isn't a nullable type. Oh, ok fine, I'll allow it.
GlitterInTheDarkNearTheTannhauserGate
if it's javascript it doesn't matter
Tom40
In databases all types allow null
stavesacre
Ah, yeah, good point
Sveniat
it could be an int*? Wait no that just makes them both null...
Mephane
That's why nullptr is the better choice. int* x = nullptr is clearer than int* x = 0
Sveniat
nullptr is still 0x00000000, but you're right that nullptr should always be used over the NULL macro (as long as your compiler supports it).
Sveniat
I guess the bit on the NULL macro is microsoft compiler specific, im not as familiar with the linux c++ world.
stavesacre
ToiletPaper.Count = 0. Empty list vs uninitialized list ????
Sveniat
Yeah but an empty object is different than "0". That's probably the closest thing though