943,937 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Unsolved
  • Views: 1751
  • C++ RSS
You are currently viewing page 1 of this multi-page discussion thread
Jun 6th, 2007
0

What is the best value for an empty point in C++?

Expand Post »
I don't ensure whether "0" or "NULL" is better to be an empty point's value in C++. Could anybody can tell me,and why?
Then how about it in C, why?

Thank you!
Similar Threads
Reputation Points: 10
Solved Threads: 0
Light Poster
meiyantao is offline Offline
31 posts
since May 2007
Jun 6th, 2007
0

Re: What is the best value for an empty point in C++?

As answered by Stroustrup:

Quote ...
In C++, the definition of NULL is 0, so there is only an aesthetic difference. I prefer to avoid macros, so I use 0. Another problem with NULL is that people sometimes mistakenly believe that it is different from 0 and/or not an integer. In pre-standard code, NULL was/is sometimes defined to something unsuitable and therefore had/has to be avoided. That's less common these days.
Super Moderator
Featured Poster
Reputation Points: 3233
Solved Threads: 719
Failure as a human
~s.o.s~ is offline Offline
8,871 posts
since Jun 2006
Jun 6th, 2007
0

Re: What is the best value for an empty point in C++?

Quote ...
Just because it is possible to push twigs along the ground with one’s nose does not necessarily mean that that is the best way to collect firewood.
I am sorry for that I can't understand what's this sentence's meaning? My English is poor.
Can you tell me what is your opinion in whether use "NULL" in C++?

Thank you very much !
Reputation Points: 10
Solved Threads: 0
Light Poster
meiyantao is offline Offline
31 posts
since May 2007
Jun 6th, 2007
0

Re: What is the best value for an empty point in C++?

>I am sorry for that I can't understand what's this sentence's meaning?
Where did you find that sentence? It's nowhere in this thread.

>Can you tell me what is your opinion in whether use "NULL" in C++?
0 and NULL are the same thing in C++. Pick one and use it consistently.
Last edited by Narue; Jun 6th, 2007 at 3:53 pm.
Administrator
Reputation Points: 6442
Solved Threads: 1393
Bad Cop
Narue is offline Offline
11,807 posts
since Sep 2004
Jun 6th, 2007
0

Re: What is the best value for an empty point in C++?

> Where did you find that sentence? It's nowhere in this thread.
Yes, its my damned signature.
Super Moderator
Featured Poster
Reputation Points: 3233
Solved Threads: 719
Failure as a human
~s.o.s~ is offline Offline
8,871 posts
since Jun 2006
Jun 6th, 2007
0

Re: What is the best value for an empty point in C++?

Get a more interesting signature! If I don't notice it, it's not worth reading.
Administrator
Reputation Points: 6442
Solved Threads: 1393
Bad Cop
Narue is offline Offline
11,807 posts
since Sep 2004
Jun 6th, 2007
0

Re: What is the best value for an empty point in C++?

Pushing twigs with one's nose never was interesting... :-)

Plus, the more interesting my signatures become, the more debate it sparks and more are the threads created in the Moderators Place. ;-)
Last edited by ~s.o.s~; Jun 6th, 2007 at 4:06 pm.
Super Moderator
Featured Poster
Reputation Points: 3233
Solved Threads: 719
Failure as a human
~s.o.s~ is offline Offline
8,871 posts
since Jun 2006
Jun 6th, 2007
0

Re: What is the best value for an empty point in C++?

The Moderator's Place has been too slow anyway. If you want, I can suggest one:
Quote ...
I hate VB.NET’s continuous bloody interference. I HADN’T FINISHED TYPING YET YOU STUPID COMPILER! CAN’T YOU SEE THAT? DOES IT LOOK TO YOU LIKE I’M DONE TYPING? DID IT NOT OCCUR TO YOU THAT THE REASON YOU’VE FOUND ALL THOSE ERRORS IS BECAUSE I’M NOT FINISHED YET?!! I’LL TELL YOU WHEN I WANT YOU TO CHECK MY WORK, AND NOT BEFORE!

-- Ian Griffiths
Ah, that guy can totally read my mind.
Administrator
Reputation Points: 6442
Solved Threads: 1393
Bad Cop
Narue is offline Offline
11,807 posts
since Sep 2004
Jun 6th, 2007
0

Re: What is the best value for an empty point in C++?

Heh good one. But since it seems that I seem to be the center of most discussions there, maybe its time someone else started playing the part of a scape goat. ;-)
Super Moderator
Featured Poster
Reputation Points: 3233
Solved Threads: 719
Failure as a human
~s.o.s~ is offline Offline
8,871 posts
since Jun 2006
Jun 6th, 2007
0

Re: What is the best value for an empty point in C++?

I can't imagine why you're so popular. I'm several orders of magnitude worse than you and nobody bats an eyelash. Maybe you're too nice. Try being meaner and you'll be accepted.
Administrator
Reputation Points: 6442
Solved Threads: 1393
Bad Cop
Narue is offline Offline
11,807 posts
since Sep 2004

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: How to find min. spanning tree ?
Next Thread in C++ Forum Timeline: problem dealing with constructor





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC