Page 2 of 2

Re: Function in C

Posted: Fri Mar 13, 2009 5:06 am
by AndrewAPrice
The advantages of floating point addresses, you could check to see if it's a NaN :)

Re: Function in C

Posted: Fri Mar 13, 2009 6:26 am
by Solar
Combuster wrote:that's why you should compare to NULL instead of comparing to 0. On machines without MMU you'll see often enough that RAM starts at 0 and the program is in ROM somewhere else. And then your code must still be able to work.
Ehm... actually, no. ;-)

The definition of a null pointer constant is "an integer constant expression with the value 0, or such an expression cast to type void *". ;-)

Re: Function in C

Posted: Fri Mar 13, 2009 9:40 am
by Creature
Solar wrote:
Combuster wrote:that's why you should compare to NULL instead of comparing to 0. On machines without MMU you'll see often enough that RAM starts at 0 and the program is in ROM somewhere else. And then your code must still be able to work.
Ehm... actually, no. ;-)

The definition of a null pointer constant is "an integer constant expression with the value 0, or such an expression cast to type void *". ;-)
Yep, I believe in C, NULL is defined as

Code: Select all

#define NULL ((void *) 0) //or something equivalent.
whilst in C++ it's defined as (or should be defined as, if you use it, according to Bjarne Stroustrup):

Code: Select all

#define NULL 0