flat assembler
Message board for the users of flat assembler.
 Home   FAQ   Search   Register 
 Profile   Log in to check your private messages   Log in 
flat assembler > High Level Languages > Need help in C (Pointers and References)

Goto page Previous  1, 2
Author
Thread Post new topic Reply to topic
baldr



Joined: 19 Mar 2008
Posts: 1651
revolution,

NULL is (as of C1X April 2011 draft) an implementation-defined null pointer constant. OTOH, chapter "6.3.2.3 Pointers" clause 3 says that "An integer constant expression with the value 0, or such an expression cast to type void *, is called a null pointer constant."

There are some other references to void * type. For example, chapter "6.2.5 Types" clause 28 tells that "A pointer to void shall have the same representation and alignment requirements as a pointer to a character type."

Caveat emptor. Wink
Post 30 Dec 2012, 23:28
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 14848
Location: Lost in translation

baldr wrote:
NULL is ... an implementation-defined null pointer constant.

That sounds more like the reality. I couldn't see any reason why NULL has to be always zero. It is only by convention that people expect it to be zero. And I think that to be a genuine NULL it should exist outside of the number space completely and not have any numeric value.

baldr wrote:
Caveat emptor. Wink

Indeed.
Post 31 Dec 2012, 00:05
View user's profile Send private message Visit poster's website Reply with quote
typedef



Joined: 25 Jul 2010
Posts: 2909
Location: 0x77760000

revolution wrote:
And I think that to be a genuine NULL it should exist outside of the number space completely and not have any numeric value.



What would its value be then?
Post 31 Dec 2012, 03:13
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 14848
Location: Lost in translation

typedef wrote:

revolution wrote:
And I think that to be a genuine NULL it should exist outside of the number space completely and not have any numeric value.



What would its value be then?

If you are asking how would it be represented then that would be implementation defined. A possible method is to associate an extra bit with each pointer that indicates whether it is null or not.
Post 31 Dec 2012, 04:20
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page Previous  1, 2

< Last Thread | Next Thread >

Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2005 phpBB Group.

Main index   Download   Documentation   Examples   Message board
Copyright © 2004-2016, Tomasz Grysztar.