Re: sizeof( function )

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



"Martin Krischik" <krischik@xxxxxxxxxxxxxxxxxxxxx> wrote:
>
> If it is invalid to use sizeof() with a function type expression - why not  
> an make it an compile time error?

That is what most compilers do.  However, gcc allows pointer arithmetic
on function pointers, to enable C code to poke through compiled code
(e.g. to disassemble code).  Given how few programmers ever do that
sort of thing, it could perfectly well issue a warning even without
-pedantic.  But it doesn't.

Note that, for C language reasons, it is virtually impossible to
separate the handling of sizeof(<type>) from allowing arithmetic on
values of type '<type> *'.


Regards,
Nick Maclaren,
University of Cambridge Computing Service,
New Museums Site, Pembroke Street, Cambridge CB2 3QH, England.
Email:  nmm1@xxxxxxxxx
Tel.:  +44 1223 334761    Fax:  +44 1223 334679

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux