Raised This Month: $51 Target: $400
 12% 

What is NULL?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
PartialCloning
Senior Member
Join Date: Dec 2015
Old 07-11-2017 , 04:52   What is NULL?
Reply With Quote #1

I see a lot of values set to "NULL" ("SetTouch(NULL);", "m_pGoalEnt = NULL;") in the game's code.

What is NULL equal to?
PartialCloning is offline
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 07-11-2017 , 05:20   Re: What is NULL?
Reply With Quote #2

Equal to 0. Mostly used as a null pointer (C++ has typesafe nullptr for this).

Last edited by klippy; 07-11-2017 at 05:21.
klippy is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 07-11-2017 , 18:11   Re: What is NULL?
Reply With Quote #3

No, 0 don't is equal null. 0 is a integer number, null is nothing.

if ($test == null) // equal nothing

if ($test == 0) // equal integer

if (0 == null) // bool false
__________________









Last edited by CrazY.; 07-11-2017 at 18:13.
CrazY. is offline
Old 07-11-2017, 18:14
PRoSToTeM@
This message has been deleted by PRoSToTeM@.
SpawnerF
Member
Join Date: Apr 2017
Location: Morocco
Old 07-11-2017 , 18:20   Re: What is NULL?
Reply With Quote #4

Quote:
Originally Posted by CrazY. View Post
No, 0 don't is equal null. 0 is a integer number, null is nothing.

if ($test == null) // equal nothing

if ($test == 0) // equal integer

if (0 == null) // bool false
He was talking about c++

KliPPy is right it's defined like that

Code:
#define NULL 0
Edit: ( Read also this )
Spoiler
__________________
XX was created just for giving evidence and not meant to damage public servers.
&We do not test on public servers.
Thank's.

Last edited by SpawnerF; 07-11-2017 at 18:22.
SpawnerF is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 07-11-2017 , 19:51   Re: What is NULL?
Reply With Quote #5

Oh, if he's referring to a language and not in general, all right. But it's worth pointing out even so not all languages that identify zero as a null. Anyway... the question is about C++ only, so my topic is off.
__________________








CrazY. is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 07-11-2017 , 20:25   Re: What is NULL?
Reply With Quote #6

Quote:
Originally Posted by CrazY. View Post
No, 0 don't is equal null. 0 is a integer number, null is nothing.

if ($test == null) // equal nothing

if ($test == 0) // equal integer

if (0 == null) // bool false
This is only (and often) true in languages that have dynamically typed variables, variables that can be any type and don't need to be defined as a specific type (e.g. Python, PHP, etc.). In my experience, these are also OO languages.
__________________

Last edited by fysiks; 07-11-2017 at 20:27.
fysiks is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 07-12-2017 , 10:03   Re: What is NULL?
Reply With Quote #7

Exactly that, with is quote I was referencing the PHP.
__________________








CrazY. is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 07-12-2017 , 20:39   Re: What is NULL?
Reply With Quote #8

Quote:
Originally Posted by CrazY. View Post
Exactly that, with is quote I was referencing the PHP.
Because clearly this is a PHP forum.
__________________
fysiks is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 07-12-2017 , 20:50   Re: What is NULL?
Reply With Quote #9

Hmm? Why you say that?
__________________









Last edited by CrazY.; 07-12-2017 at 20:51.
CrazY. is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 20:14.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode