P((int));

S

Sean M. Tucker

Hi,
I've seen this in some code, "char* blah P((int))" or "Void* stuff
P((double))"

What does this mean? I've been looking all around and can't find an answer.
Search engions are no help 'cuz they ignore, "((" and "))".

Thanks.

-0x53 0x20 0x65 0x20 0x61 0x20 0x6E
 
M

Mike Wahler

Sean M. Tucker said:
Hi,
I've seen this in some code, "char* blah P((int))" or "Void* stuff
P((double))"

What does this mean?

I'll assume that where you wrote 'blah', and 'stuff',
the actual code has something else. Why not post *exactly*
what you saw? And what it means could easily depend
upon context.

I've been looking all around and can't find an
answer.

I'm not surprised. Your question is very vague.

-Mike
 
R

Rob Williscroft

Sean M. Tucker wrote in
in comp.lang.c++:
Hi,
I've seen this in some code, "char* blah P((int))" or "Void* stuff
P((double))"

What does this mean? I've been looking all around and can't find an
answer. Search engions are no help 'cuz they ignore, "((" and "))".


P( X ) is a macro (#define) that either expands to X (ANSI/ISO mode) or
to () (K & R mode), it allows code to be compiled with a pre-standard
C (not C++ (*)) compiler or with a Standard C or C++ compiler.

*) C++ has never allowed prototypes without the paramiter list.

eg:

char *blah P((int));

With a pre-standard C compiler this will be expanded too:

char *blah ();

With a modern Standard conforming compiler this will be:

char *blah( int );

Whenever you see UPERCASENAME(( something )) there is a fair chance
that some kind of macro trickery is going on.

The double parens' are needed so that (possibly empty) comma
seperated list's can be passed to the macro.

void f P((int, char)); /* void f( int, char ); */

Rob.
 

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,011
Latest member
AjaUqq1950

Latest Threads

Top