Underscore

F

foaud167

i was looking at the code of GNU m4 (/src/eval.c to be specific) and
saw this in function prototypes

static eval_error logical_or_term _((eval_token, eval_t *));
__________________________________^

what is this underscore for?
 
V

Villy Kruse

i was looking at the code of GNU m4 (/src/eval.c to be specific) and
saw this in function prototypes

static eval_error logical_or_term _((eval_token, eval_t *));
__________________________________^

what is this underscore for?

It is a macro, defined in one of the #include files. Probably
the purpose is to create a pre-ANSI or proper ANSI prototype depending on
the compiler being used.


Villy
 
C

Chris Croughton

i was looking at the code of GNU m4 (/src/eval.c to be specific) and
saw this in function prototypes

static eval_error logical_or_term _((eval_token, eval_t *));
__________________________________^

what is this underscore for?

Underscore is a valid character for an identifier. Admitedly it's not
usual to just have _ as a name, but that's presumably why it's used.

In this case, you should find it in a #define in a header file
somewhere, defining a macro. This is used to switch function prototype
arguments off for pre-ISO compilers, something like:

#ifdef NO_PROTOTYPES
#define _(x) ()
#else
#define _(x) x
#endif

Thus if NO_PROTOTYPES is defined, the prototype you quote will be

static eval_error logical_or_term ();

otherwise (normally now) it will be

static eval_error logical_or_term (eval_token, eval_t *);

Chris C
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top