[Freeciv-Dev] Re: Profiling Civserver again
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
On Thu, 2 Aug 2001, Vasco Alexandre Da Silva Costa wrote:
>
> Of course this sentence is unclear. Do they mean you must do it like this
> if you want to use 0?:
>
> if (p==0)
> if (p!=0)
If you read it a bit more, they make it clear. if(p) is equivilant to
if(p!=0) and will work. However, if you read Q 5.17, they do list a bunch of
machines which have null pointers which do not have the value 0. It's just
that the C compile is supposed to realize that in a pointer context 0 means
NULL, whatever value that happens to be. The only problem is when you try to
store a pointer inside another variable type, like a long, or use a fuction
with no prototype so the compile doesn't know you are in a pointer context.
for instance..
int *p = NULL;
long l = p;
if(l != 0) printf("your machine has non-zero null pointers)
or...
main()
{
function_with_no_prototype(NULL); // Will say "NULL not passed"
// if machine has non-zero null pointers
}
int function_with_no_prototype(int *p)
{
if(p!=0) printf("NULL not passed\n");
}
- [Freeciv-Dev] Re: map_adjust_x (was: Profiling Civserver again), (continued)
- [Freeciv-Dev] Re: Profiling Civserver again, Vasco Alexandre Da Silva Costa, 2001/08/01
- [Freeciv-Dev] Re: Profiling Civserver again, Ross W. Wetmore, 2001/08/01
- [Freeciv-Dev] Re: Profiling Civserver again, Robert Brady, 2001/08/01
- [Freeciv-Dev] Re: Profiling Civserver again, Vasco Alexandre Da Silva Costa, 2001/08/01
- [Freeciv-Dev] Re: Profiling Civserver again, Trent Piepho, 2001/08/01
- [Freeciv-Dev] Re: Profiling Civserver again, Vasco Alexandre Da Silva Costa, 2001/08/01
- [Freeciv-Dev] Re: Profiling Civserver again,
Trent Piepho <=
- [Freeciv-Dev] Re: Profiling Civserver again, Greg Wooledge, 2001/08/02
- [Freeciv-Dev] Re: Profiling Civserver again, Jules Bean, 2001/08/02
- [Freeciv-Dev] Re: Profiling Civserver again, Gaute B Strokkenes, 2001/08/06
- [Freeciv-Dev] Re: Profiling Civserver again, Gaute B Strokkenes, 2001/08/02
- [Freeciv-Dev] Re: Profiling Civserver again, Paul Zastoupil, 2001/08/02
- [Freeciv-Dev] Re: Profiling Civserver again, Lino Mastrodomenico, 2001/08/03
- [Freeciv-Dev] Re: Profiling Civserver again, Gaute B Strokkenes, 2001/08/03
- [Freeciv-Dev] Re: Profiling Civserver again, Gaute B Strokkenes, 2001/08/04
|
|