|
What is OF used for? |
Doctor Cop
Member #16,833
April 2018
|
I found this piece of code at GitHub and i wondered what it might be for, then I Googled "What is OF used for in C?". Did I searched it wrong? #ifdef Z_SOLO void *myalloc OF((void *, unsigned, unsigned)); void myfree OF((void *, void *)); void *myalloc(q, n, m) void *q; unsigned n, m; { (void)q; return calloc(n, m); }
|
Edgar Reynaldo
Major Reynaldo
May 2007
|
It looks like a macro. OF isn't standard C. Also, use code tags please. <code>code goes here....</code> My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
Peter Hull
Member #1,136
March 2001
|
It's part of zlib, isn't it? It's used here to declare a function with or without types. If STD_C is defined you will get void *myalloc (void *, unsigned, unsigned); void myfree (void *, void *); otherwise void *myalloc (); void myfree (); The first is correct for all modern C compilers (that is, more recent than the 1980s probably!) whereas older compilers used the second form. So, the overall purpose is for compatibility.
|
Doctor Cop
Member #16,833
April 2018
|
Thanks Peter, yes it's of zlib.
|
Niunio
Member #1,975
March 2002
|
It is a bit off-topic but there were years that I didn't see good ol' K&R C code. Doctor Cop said: void *myalloc(q, n, m) void *q; unsigned n, m; { (void)q; return calloc(n, m); }
----------------- |
|