C fag here

C fag here.
Why are non-C-fags so afraid of NULL?

Attached: null.jpg (500x500, 15K)

I found out you can use it in java if statements and have been doing it since.

Are you indian?

Nope use it in java/scala

Fuck off

Attached: 1560496185790.jpg (1024x768, 120K)

The hip thing to do is to use optional types to encode nullability in the type system. So a Foo will never be null, but an Option may be. The reasoning is that it makes it obvious what may and may not be null.

>Why are non-C-fags so afraid of NULL?
Because of what C-fags have done with it.

But why OP Jews fear the NULL

Vanilla WoW add-ons was a perfect example of null types being bad in a language. It was the most prominent error because of shitty programmers and now we have languages forces programmers to deal with potential null types so we should use those languages instead.

It's not abstracted away to some nebulous idea or nothingness. The idea of "nothing" being "something" that is tied down to hardware limitations frightens and confuses their simple minds.

Implying.

>afraid
Oh look, another SJW.
We're not "afraid" of your trannyshit and dialation, we're actively disgusted by it. By the same token, better languages don't need NULL.

Newfriend here,
what is null really?
Let's use an 8bit computer with a 16 bit program counter.
So all pointers have the form 0xAAAA which means NULL is some valid address?
I mean even if ram is mirrored, say you really only have 16KiB or 32 KiB, thats still a valid address no matter what 16bit number it is.

nice try rust tranny kys

By convention, 0x0 is null. It's technically a valid address but we simply presume that C programs will never need to use it otherwise.

why not let the programmer decide what NULL is.

rowl

NULL is just another way to say 0, but typically they're used in different cases:
0x0000... = it starts at 0
NULL = we don't know

Because having be some random arbitrary address or value would confuse programmers who are used to working with addressing.

rolan

Roll!

What does it even matter when you only have virtual addresses anyway

roll

Rolling

Ro ro rollin

>shitty programers
>thus null is bad
Well. Maybe sjlhitty programmers are the probblem then?

>Not using Optional

Attached: lim.png (586x578, 37K)

optional in java is worthless

sir please give name and Doo the needful

Yeah, it's not like any serious security issue happened in popular software due to typical errors in C code. Just write good code lmao.

roll

rolling

Role

Roll ee

they fear the void

Because conventions in matters like “where the NULL pointer ought to point to” are important, because you can easily break the portability of C and many well-written programs if you do shit like change where NULL points to.

You mean shit like Heartbleed and Shellshock, which can also be done in your meme tranny languages?

Null is basically a zero'd out pointer. It's still "valid" it just has no value. It's kind of like air in a room, it's there, but it's just empty space.

>be in CS class
>professor writes "int x;" on the board and asks the class what the value of x is
>all of the pajeets immediately chant out "null" without missing a beat
>professor facepalms

Attached: c375d597-0e3d-44a5-874a-56ccdd9ff35f..jpg (436x536, 51K)

Except fuck Rust in the ass too, just the way you like it, you worthless tranny faggot.
Join the 40% of your mental mates and an hero.

null is bad because it should be type checked, such that you have non-nullable type which enforces and proves at compile time a value can't be null, or a nullable type which forces you to always check its value.

That way you don't have to keep track and keep redundantly checking whether a thing is null or not, which becomes very hard in a large program.

Databases have much better nulls imo, which much better represent unknown values, and which don't throw exceptions (which I think are also bad for the same reasons).

why are c fags so afraid of nullptr ?

>NULL == 0

The more important question is why are CIA niggers don't want people to use switch.

(NULL | FALSE) == 0

null is for references

Worth noting its "obvious" in a static-checking kind of way, not just for human readers.

So java has generics/templates now? Huh, finally

because their brains are null

Java has generics since Java 5 in 2004.
But Optional is useless because you still have nulls everywhere.

Oohohohoho, I'm glad we agree, highly intelectual user.
Seriously, don't people learn about error handling?
>but muh classes.
It's C fucker, if you want to make an "EmptyAccount" just for your brainlet mind to understand the concept of nothing then do it, faggot.

Attached: 1560497506484 1546751535085.png (1080x1331, 938K)

c error handling sucks balls

I'm not afraid of NULL, I am afraid of seg faults.

You can but you would end up breaking everything that relies on that.

(anything | false) == 0

The absolute state of hll fags.

>null is bad because it should be type checked, such that you have non-nullable type which enforces and proves at compile time a value can't be null, or a nullable type which forces you to always check its value.

I thought clang did this

because the new-age coders can't wrap their heads around how pointers work.

What does it even matter, C uses virtual address space too

It's ambiguous and not type safe.

>it has no value
If it points to a valid address it has the value of the data store at that address. There isnt a black hole at a particular address in ram is there?

>non-C
null exists in Javascript and it's perfectly fine

>99% of all important code is in C
>the shear volume of code is big hence the percentage of that volume which has errors is a big number when multiplied with the total volume
>hurrrrrr so many bugs!! C BAD, MEME LANGUAGE GOOD

Too many retards overuse null because they cant wrap their heads around basic exception handling so they use null to indicate failure everywhere

exception handling is for poojeets

Exception handling is for proper code.

Exception handling is for shitcode. Just use option/either types.

Ready to backpedal to no true Scotsman, aren't you?

Still more vulns when you adjust for code size. Not that you should, bad tools are bad tools. C is ok but it's not cut out for modern security requirements.

Underrated

Not the same guy.
I see your point but I disagree.
C is a much more used and tested out language.
That results in more issues being found.
"Adjusting for code size" doesn't matter when a
language hasn't been used for as long or as much.

based

This is a typical response:
"Ohh, you should never have it mapped to a zero constant via define"
'Also, you use it when you don't want to use a parameter or when you don't want a return using references, it's too convoluted."
"And terminating strings with it. OH MY GOD, THAT WAS SO BAD"

No it doesn't.
Exceptions suck balls and turn your clean and beautiful algorithm into Robocop sysinternals code

there are alternatives to error codes beside exceptions

/inb4 games are not proper codes
Most of the game industry explicitly disables exception handling in their compilers.
And we're talking about an industry that's 95% C++

do c programmers write unit tests?do they even test their code or safety is absolutely not in their dictionary?

>0
>null
>undefined
>NaN
>-NaN

Attached: 1551289108797.jpg (600x458, 65K)

AAAH REMOVE THAT IMAGE IT SCARES THE SHIT OUT OF ME

Read my post. It's just empty space.

Optional can be null too

because dereferencing nulls bugs caused losses worth of billions of dollars and probably thousands of lives. It happened countless times even with experienced engineers and respectable companies that you can never work for.

So why should we be afraid of NULLs? because it is single handedly the most dangerous bug ever produced since the dawn of computing

wrong
(2 | FALSE | NULL) == 2

kek, do they even know what variable initialisation is

There... Are languages that don't have NULL? Explain. What do you set empty pointers to?
> t. has only ever used C, C++, and Java

Attached: The_Dark_Lord_Ending.jpg (1280x720, 77K)

Attached: 0 and null.jpg (1024x576, 104K)

This is bait.
Any engineer worth his salt (infra, devops, or SWE) will know that "null is a billion dollar mistake". There is a distinction between an empty type, a nullable type, and a zero type.

You set pointers to the zero type of type . Just like abstract algebra, there is a zero type for integers.

See I'm inebriated

But isn't null the zero type of pointers? That's what I initialize my pointers to. What do you initialize pointers to in other languages? Why isn't it called null?

instead of checking for null why not have a valid typeclass/interface that allows you to check if a value is valid. no extra boolean like std::optional and no weird null shit like C

Pointers only point to valid objects.

The zero type of pointers is empty IMO. You're pointing to a memory address that doesn't exist. It's either below 0x00000000 (whatever) or 2^WORD_SIZE-1

Dunno how it's done in Rust or other languages.

I don't even get what's the point of Optional?
if(myOptional.isPresent()) {...}

vs
if(myObjects != null) {...}

Is it just to make it more obvious that it's nullable?

So to initialize/clear a pointer you write pointerName = 0x00000000? I'm not being intentionally dense here I genuinely don't get what replaces null in other languages

Yes, the type system tells you whether something is null. That way you're never confused about whether something may or may not be null.
In Java it's useless though, because everything can be null anyway.

Nothing replaces null. You initialize the variable with a pointer to some real memory location or you don't replace it at all. If the pointer is initialized it always points somewhere. That's the reason for removing null.

I'm saying that in a theoretical language that doesn't exist, you'd have an empty pointer type. It might be something weird like a negative number.

*or you don't initialize it at all.

Maybe we could call it null.