P
polas
Afternoon all,
I have some code (which I thought was OK, but now appreciate is
probably not by the standard) which contains
int a;
......
if (a==NULL)
{
....
}
Compiling with GCC was fine - no problem, however with PGI gave an
error. Therefore, I assume that checking that an integer contails NULL
is not allowed by the standard. But if a is declared like that,
without a value, then what is its value (or is it undetermined) at
that point, and is there a way to check, without using dummy values,
whether an integer variable has had a value assigned to it?
I also notice that, although it produces a cast warning, PGI allows me
to assign NULL to an integer i.e. int a=NULL; What, or is it
implementation specific, is the actual value of the variable in this
case?
Cheers,
Nick
I have some code (which I thought was OK, but now appreciate is
probably not by the standard) which contains
int a;
......
if (a==NULL)
{
....
}
Compiling with GCC was fine - no problem, however with PGI gave an
error. Therefore, I assume that checking that an integer contails NULL
is not allowed by the standard. But if a is declared like that,
without a value, then what is its value (or is it undetermined) at
that point, and is there a way to check, without using dummy values,
whether an integer variable has had a value assigned to it?
I also notice that, although it produces a cast warning, PGI allows me
to assign NULL to an integer i.e. int a=NULL; What, or is it
implementation specific, is the actual value of the variable in this
case?
Cheers,
Nick