S
sh.vipin
In the following program, with
gcc version 3.2.3 20030502 (Red Hat Linux 3.2.3-56)
there is no error. I have two queries.
1. isn't it illegal to apply sizeof on function type.
6.5.3.4 The sizeof operator
The sizeof operator shall not be applied to an expression that has
func
tion type....
in fact VS 2005 gives error on this.
2. If compiler is taking f as a pointer and not as function name,
which is legal to do though i am not sure if it is advisable to do so
here in this case, then why the sizeof f is "1" and not 4 as for
sizeof g
/** fully compilable program */
#include <stdio.h>
void f(void ){
}
void (*g)(void);
int main(int argc, char *argv[]){
g = f;
printf("\n%u %u",sizeof f , sizeof g);
}
-- vIpIn
gcc version 3.2.3 20030502 (Red Hat Linux 3.2.3-56)
there is no error. I have two queries.
1. isn't it illegal to apply sizeof on function type.
6.5.3.4 The sizeof operator
The sizeof operator shall not be applied to an expression that has
func
tion type....
in fact VS 2005 gives error on this.
2. If compiler is taking f as a pointer and not as function name,
which is legal to do though i am not sure if it is advisable to do so
here in this case, then why the sizeof f is "1" and not 4 as for
sizeof g
/** fully compilable program */
#include <stdio.h>
void f(void ){
}
void (*g)(void);
int main(int argc, char *argv[]){
g = f;
printf("\n%u %u",sizeof f , sizeof g);
}
-- vIpIn