Operating System - HP-UX
1848332 Members
8013 Online
104024 Solutions
New Discussion

HP-UX/IA64 and HP C : Is "__typeof__" keyword supported?

 
SOLVED
Go to solution
David R Ball
New Member

HP-UX/IA64 and HP C : Is "__typeof__" keyword supported?

I am attempting to make use of either the "__typeof__" or "typeof" keyword in some C code. Unfortunately I have tried both with various cc command options and neither seem to be recognised by the compiler. Does anyone know if they are supported?

HP-UX Version (uname -s -n -r -v -m):
HP-UX hpitaniu B.11.23 U ia64

HP C Version (cc -V):
cc: HP C/aC++ B3910B A.06.20 [May 13 2008]

Simple program I testing with:

1 #include
2 #include
3
4 int main(int argc, char **argv)
5 {
6 int i = 0;
7 __typeof__ (i) x = 2;
8
9 fprintf(stdout, "i=%d, x=%d\n", i, x);
10
11 return(EXIT_SUCCESS);
12 }



Two command lines I have tried:

--------------------------------8<--------------------

prompt>cc try_typeof.c
"try_typeof.c", line 7: error #2065: expected a ";"
__typeof__ (i) x = 2;
^

"try_typeof.c", line 9: error #2020: identifier "x" is undefined
fprintf(stdout, "i=%d, x=%d\n", i, x);
^

2 errors detected in the compilation of "try_typeof.c".

--------------------------------8<--------------------

prompt> cc -AC99 try_typeof.c
demo mode expires on 12/05/09 (28 days from now).
"try_typeof.c", line 7: warning #2223-D: function "__typeof__" declared
implicitly
__typeof__ (i) x = 2;
^

"try_typeof.c", line 7: error #2065: expected a ";"
__typeof__ (i) x = 2;
^

"try_typeof.c", line 9: error #2020: identifier "x" is undefined
fprintf(stdout, "i=%d, x=%d\n", i, x);
^

2 errors detected in the compilation of "try_typeof.c".

--------------------------------8<--------------------
2 REPLIES 2
Dennis Handly
Acclaimed Contributor
Solution

Re: HP-UX/IA64 and HP C : Is "__typeof__" keyword supported?

>Does anyone know if they are supported?

Only in GNU mode: -Agcc
David R Ball
New Member

Re: HP-UX/IA64 and HP C : Is "__typeof__" keyword supported?

Thanks Dennis. I didn't spot that option. I tried it and it did the trick.