Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > Underscore

Reply
Thread Tools

Underscore

 
 
foaud167
Guest
Posts: n/a
 
      01-05-2005
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?

 
Reply With Quote
 
 
 
 
Villy Kruse
Guest
Posts: n/a
 
      01-05-2005
On 5 Jan 2005 05:29:09 -0800,
foaud167 <(E-Mail Removed)> wrote:


> 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
 
Reply With Quote
 
 
 
 
Chris Croughton
Guest
Posts: n/a
 
      01-05-2005
On 5 Jan 2005 05:29:09 -0800, foaud167
<(E-Mail Removed)> wrote:

> 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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to add a underscore to indicate users what is the shorcut key of Button? ABC ASP .Net 1 04-22-2006 11:44 AM
Underscore problem Stan Firefox 6 01-02-2006 05:47 AM
Display an underscore before the data in a column Antonio ASP .Net 2 11-04-2005 08:39 PM
Why should instance variable names not start with '_' (underscore)? Kerry Kimbrough Java 6 02-27-2004 04:31 PM
Problem to remove underscore in template Mikael Petterson XML 4 09-20-2003 07:13 PM



Advertisments