tru64-unix-managers (formerly alpha-osf-managers) (1994-2012)
 help / color / mirror / Atom feed
* stat is a macro
@ 2002-11-29 23:20 Steve Feehan
  0 siblings, 0 replies; only message in thread
From: Steve Feehan @ 2002-11-29 23:20 UTC (permalink / raw)


I've seen several posts regarding the fact that stat, lstat and 
fstat are macros wrapping the _F64_* functions. This works fine
with the compaq c compiler, and with gcc as long as the address
of the function isn't taken. In this case, the compaq compiler
knows what to do. But how to fix the gcc case? The answer I've 
seen in other posts is "use the compaq compiler". No. :) 

As an example of the code I'm refferring to:

#include <sys/types.h>
#include <sys/stat.h>
#include <stdio.h>

int main(int argc, char * argv[])
{
    struct stat sbuf;
    int err;
    int (*stat_fun)(const char *, struct stat *) = stat;
    err = stat_fun("/dev/null", &sbuf);
    if (err < 0)
    {
        perror("stat_fun");
        return 1;
    }

    return 0;
}

What is the "correct" way to make this work with gcc (or other 
non-compaq compilers)?

Thanks and I will summarize.

-- 
Steve Feehan
Unix Systems Administrator
Structural Biology and Bioinformatics
University of Vermont


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2002-11-29 23:20 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-11-29 23:20 stat is a macro Steve Feehan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox