N
Noob
Hello,
While debugging the output of a configure script, I came across
the following program, which is refused by gcc.
int main(void)
{
int res = sizeof((int));
return res;
}
$ gcc -Wall -std=c89 -pedantic mini.c
mini.c: In function 'main':
mini.c:3:25: error: expected expression before ')' token
Obviously, the compiler dislikes the double parenthesis
around a type-name.
Does this mean ((int)) cannot be takes as a unary-expression?
However ((x)) or ((42)) are valid instances of unary-expression?
http://www.cs.dartmouth.edu/~mckeeman/cs48/mxcom/doc/notation/c.html
unary-expression
postfix-expression
++ unary-expression
-- unary-expression
unary-operator cast-expression
sizeof unary-expression
sizeof ( type-name )
Regards.
While debugging the output of a configure script, I came across
the following program, which is refused by gcc.
int main(void)
{
int res = sizeof((int));
return res;
}
$ gcc -Wall -std=c89 -pedantic mini.c
mini.c: In function 'main':
mini.c:3:25: error: expected expression before ')' token
Obviously, the compiler dislikes the double parenthesis
around a type-name.
Does this mean ((int)) cannot be takes as a unary-expression?
However ((x)) or ((42)) are valid instances of unary-expression?
http://www.cs.dartmouth.edu/~mckeeman/cs48/mxcom/doc/notation/c.html
unary-expression
postfix-expression
++ unary-expression
-- unary-expression
unary-operator cast-expression
sizeof unary-expression
sizeof ( type-name )
Regards.