what does this statement mean

R

raghu

Hello
This is raghu. And I want to know about the meaning of the statement
given below
log_txt( __FILE__, __LINE__, ##argList);
in above statement what does FILE ,LINE ##argList mean. I want to know
about is it possiable to send arguments like that.
Thanking you in advance
 
I

Ian Collins

raghu said:
Hello
This is raghu. And I want to know about the meaning of the statement
given below
log_txt( __FILE__, __LINE__, ##argList);
in above statement what does FILE ,LINE ##argList mean. I want to know
about is it possiable to send arguments like that.
Look __FILE__, __LINE__ and ## up in K&R. It's all explained clearly there.
 
R

Racaille

Ian said:
Look __FILE__, __LINE__ and ## up in K&R. It's all explained clearly there.

maybe I'm talking out of my ass, but I always thought that using ', ##'
(to suppress the
comma when the last argument is void) is a GCC extension, and not K&R
or standard C.
 
R

Richard Heathfield

Racaille said:
maybe I'm talking out of my ass, but I always thought that using ', ##'
(to suppress the
comma when the last argument is void) is a GCC extension, and not K&R
or standard C.

## is standard C preprocessor syntax for token-pasting. Its use outside a
macro definition (or of course a comment, string literal, etc) is simply an
error.
 
R

Random832

2006-11-29 said:
Racaille said:


## is standard C preprocessor syntax for token-pasting. Its use outside a
macro definition (or of course a comment, string literal, etc) is simply an
error.

GCC does assign it special meaning within variadic macro definitions
where the token before it is the comma and the token after it is the
name of the variadic argument list (gcc variadic macros can have that be
somthing other than __VA_LIST__)

This is all off-topic, of course, but still better than trying to
explain it in a "standard" context when it's clearly a non-standard
usage.
 
R

Racaille

Richard said:
## is standard C preprocessor syntax for token-pasting. Its use outside a
macro definition (or of course a comment, string literal, etc) is simply an
error.

OK, is this usage of '##' standard c99 ?

--
#define COCO(a, ...) a, ## __VA_ARGS__
int
main(void)
{
return COCO(0);
}
 

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

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top