sizeof(function)

Horst von Brand vonbrand@inf.utfsm.cl
Fri Jun 16 12:38:00 GMT 2000


Andi Kleen <ak@muc.de> said:
> The following program outputs 1: 
> 
> main()
> {
> 	printf("%d\n",sizeof(main));
> }	
> 
> Why does it not give an error ? The c9x draft does not seem to define
> this case, but surely it should at least warn about this.

Whenever you mention a function without calling it, you get a pointer to
the function, isn't it? 1 is wrong in any case.
-- 
Dr. Horst H. von Brand                       mailto:vonbrand@inf.utfsm.cl
Departamento de Informatica                     Fono: +56 32 654431
Universidad Tecnica Federico Santa Maria              +56 32 654239
Casilla 110-V, Valparaiso, Chile                Fax:  +56 32 797513


More information about the Gcc-bugs mailing list