P((int));

Discussion in 'C++' started by Sean M. Tucker, Jul 24, 2004.

  1. 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
    Sean M. Tucker, Jul 24, 2004
    #1
    1. Advertising

  2. Sean M. Tucker

    Mike Wahler Guest

    "Sean M. Tucker" <> wrote in message
    news:k1jMc.2591$...
    > 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
    Mike Wahler, Jul 24, 2004
    #2
    1. Advertising

  3. Sean M. Tucker wrote in
    news:k1jMc.2591$ 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.
    --
    http://www.victim-prime.dsl.pipex.com/
    Rob Williscroft, Jul 24, 2004
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Schnoffos
    Replies:
    2
    Views:
    1,194
    Martien Verbruggen
    Jun 27, 2003
  2. Hal Styli
    Replies:
    14
    Views:
    1,608
    Old Wolf
    Jan 20, 2004
  3. arun
    Replies:
    8
    Views:
    429
    Dave Thompson
    Jul 31, 2006
  4. aling
    Replies:
    8
    Views:
    931
    Jim Langston
    Oct 20, 2005
  5. Replies:
    9
    Views:
    416
    James Kanze
    Apr 17, 2007
Loading...

Share This Page