Uploaded by Background Pony #FECE
1550x2100 JPG 96 kBInterested in advertising on Derpibooru? Click here for information!
Help fund the $15 daily operational cost of Derpibooru - support us financially!
Description
No description provided.
Tags
+-SH safe2222746 +-SH artist:luciferamon340 +-SH oc973054 +-SH oc only710337 +-SH oc:iuth35 +-SH pony1653062 +-SH unicorn561239 +-SH backwards ballcap1276 +-SH baseball cap3114 +-SH cap7058 +-SH facing away597 +-SH hat128853 +-SH null231 +-SH simple background621375 +-SH sitting96490 +-SH solo1468472 +-SH speech bubble42085 +-SH white background170908
Loading...
Loading...
You’re welcome. I realize that I probably went into way more detail than necessary in a Derpibooru comment section, but it’s a subject I really enjoy talking (or writing) about.
Edited
Defining
NULL
as((void\*)0)
is valid in C, but C____ doesn’t allow implicit casting fromvoid\*
to any other pointer type, so before C++11, most implementations definedNULL
as0
or0L
.However, that causes problems when dealing with overloaded functions, because given two functions with the signatures
void print(int)
andvoid print(char\*)
, a call ofprint(NULL)
will prefer the first function on implementations whereNULL
is anint
and refuse to compile altogether on grounds of ambiguity ifNULL
is0L
(because implicit conversions from0L
toint
and from0L
tochar\*
are both allowed).Since C++11, the standard states that
NULL
can be ““an integral literal with value zero, or a prvalue of type std::nullptr_t[](https://en.cppreference.com/w/cpp/types/NULL), depending on implementation. I don’t know about other implementations, but GCC 8.1 continues to defineNULL
as0L
, probably because changing it now would break legacy code.Edited
NULL
macro is deprecated in favor of thenullptr
keyword. Don’t you care at all about predictable overload resolution and template argument deduction?Because it is
N U L L
Edited
void *p = NULL;
1–2–3