sizeof(function) functionality

Ben Davis bndavis@ntlworld.com
Tue Jul 8 13:27:00 GMT 2003


Oops, I forgot to give an example of usage (not that you probably need it :)

On Tuesday 8 July 2003 1:56 pm, Ben Davis wrote:
> #define DEFINE_SIZED_FUNCTION(rtype, name, params, body) \
>     rtype name params body \
>     void endof_##name(void) { }
>
> #define DECLARE_SIZED_FUNCTION(rtype, name, params) \
>     rtype name params; \
>     void endof_##name(void);

DECLARE_SIZED_FUNCTION(float, myfunc, (float x, float y))

DEFINE_SIZED_FUNCTION(float, myfunc, (float x, float y), {
    return (float)sqrt(x*x + y*y);
})

Ben



More information about the Gcc-help mailing list