Function in C
- AndrewAPrice
- Member
- Posts: 2299
- Joined: Mon Jun 05, 2006 11:00 pm
- Location: USA (and Australia)
Re: Function in C
The advantages of floating point addresses, you could check to see if it's a NaN
My OS is Perception.
Re: Function in C
Ehm... actually, no.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.
The definition of a null pointer constant is "an integer constant expression with the value 0, or such an expression cast to type void *".
Every good solution is obvious once you've found it.
Re: Function in C
Yep, I believe in C, NULL is defined asSolar wrote:Ehm... actually, no.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.
The definition of a null pointer constant is "an integer constant expression with the value 0, or such an expression cast to type void *".
Code: Select all
#define NULL ((void *) 0) //or something equivalent.
Code: Select all
#define NULL 0
When the chance of succeeding is 99%, there is still a 50% chance of that success happening.