Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

OF in C function prototype declaration

2 views
Skip to first unread message

Kuhl

unread,
Nov 6, 2009, 9:34:00 AM11/6/09
to
I see some prototype declaration of C functions like below, which has
OF in front of the brackets:

/* in deflate.c */
void lm_init OF((int pack_level, ush *flags));
ulg deflate OF((void));

What does the OF mean here? Thanks.

Jens Thoms Toerring

unread,
Nov 6, 2009, 10:03:41 AM11/6/09
to

No idea. It looks like a macro that might be defined somewhere,
either somewehre else in the program or by your compiler.
Perhaps it's for catering for very old compilers (from before
the C standard of 1989, that didn't accept an argument list in
function prototypes and this is a macro similar to

#ifdef STANDARD_C_COMPILER
#define OF(a) a
#else
#define OF(a) ()
#endif
Regards, Jens
--
\ Jens Thoms Toerring ___ j...@toerring.de
\__________________________ http://toerring.de

Eric Sosman

unread,
Nov 6, 2009, 10:06:17 AM11/6/09
to

It is probably a macro, and you will probably find a
definition for it somewhere in the source, most likely in
one of the #include'd headers. Macros like this were often
used when the ANSI C Standard was new and many pre-ANSI
compilers were still in use. On an ANSI compiler, the macro
would be #define'd to produce

void lm_init(int pack_level, ush *flags);

but on a pre-ANSI compiler it would be defined to yield

void lm_init();

since pre-ANSI compilers couldn't process function prototypes.

Nowadays, twenty years after the ANSI Standard was adopted,
macros like this are not useful. You'll probably find them
only in old code, as a sort of archaeological remnant.

--
Eric Sosman
eso...@ieee-dot-org.invalid

0 new messages