it weirds me out how it's taken soooo long for modern languages to start phasing nullable types as default out. Even go has the bloody things as the base type for a bunch of their objects. Crazy how persistent it is.
it is a very bad idea to have variables initialize by default to something readable, as it makes it so you can ignore problems in your code that can mess you up much later on and become harder to find. you never want code to do something you don't intend it to do.
In C++ value types and references are never null (unless you are an special kind of asshole). In modern C++ you are only supposed to use pointers if you need the ability to put null in it or reseat it (if you only need to reseat it use gls::not_null<T*>), otherwise just use references.
50
u/DerMathze Aug 11 '19
Holy crap a Detective Conan meme? I never thought I'd see the day.
2
u/RustyNova016 Aug 11 '19
Sauce?
15
u/manghoti Aug 11 '19
it weirds me out how it's taken soooo long for modern languages to start phasing nullable types as default out. Even go has the bloody things as the base type for a bunch of their objects. Crazy how persistent it is.
1
u/AfutureV Aug 11 '19
Is that, !%^*~, a real thing?
2
u/Omniredditors Aug 11 '19
Nullpo
1
u/IlonggoProgrammer Aug 12 '19
This is why I love Kotlin. Built in null checking
1
u/Finianb1 Sep 01 '19
The billion dollar mistake, as Tony Hoare described his choice of making the NULL pointer
1
u/[deleted] Nov 18 '19
Everybody gangsta till google drawings
1
u/John137 Aug 11 '19
java made you people weak.