I know that referencing the address of a registered variable results in a compile error.
int main()
{
register int i = 10;
int *a = &i;
printf("%d", *a);
getchar();
return 0;
}
As expected, this gave a compiler error when using gcc because of the reference to the address of registered variable i.
Then how is it that the following code, which does something similar, results in no error?
#include<stdio.h>
int *NEXT(register int i)
{
int *ipt;
ipt = &i;
ipt++;
return ipt;
}
main ()
{
int j=2;
printf("%d",(NEXT(j)));
}
EDIT : My gcc version in
i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00) Copyright (C) 2007 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.