What following statement means?

Discussion in 'C++' started by wenmang@yahoo.com, Apr 26, 2005.

  1. Guest

    //a header file

    #define API_ABC

    //a CPP file

    class API_ABC Myclass;


    class Myclass{
    ......
    };

    What does "#define API_ABC" do when declaring a class(Myclass in this
    case)? Why use it?

    Thanks.

    WM
    , Apr 26, 2005
    #1
    1. Advertising

  2. wrote:
    > //a header file
    >
    > #define API_ABC
    >
    > //a CPP file
    >
    > class API_ABC Myclass;
    >
    >
    > class Myclass{
    > .....
    > };
    >
    > What does "#define API_ABC" do when declaring a class(Myclass in this
    > case)? Why use it?


    Why don't you ask the one who wrote it?

    In some systems you're allowed to give additional qualifiers to any
    symbol or class, like __declspec(dllexport) or some such nonsense.
    Perhaps in some other incarnation of this code 'API_ABC' is actually
    defined to expand into some kind of linkage specification...

    V
    Victor Bazarov, Apr 26, 2005
    #2
    1. Advertising

  3. In message <>,
    writes
    >//a header file
    >
    >#define API_ABC
    >
    >//a CPP file
    >
    >class API_ABC Myclass;
    >
    >
    >class Myclass{
    >.....
    >};
    >
    >What does "#define API_ABC" do when declaring a class(Myclass in this
    >case)?


    Nothing, in this case.

    >Why use it?


    (a) Maybe as a hint to the maintainer that the class is an abstract base
    class needed for this application programming interface .

    (b) In some programming environments the macro might be differently
    defined, so it expands to some (non-standard) compiler- and
    platform-dependent string which tells the compiler to do something
    special with the class.

    --
    Richard Herring
    Richard Herring, Apr 26, 2005
    #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. Stimp
    Replies:
    3
    Views:
    288
    Marina Levit [MVP]
    Nov 10, 2006
  2. ooze

    usage of # in the following statement

    ooze, Jun 29, 2004, in forum: C Programming
    Replies:
    3
    Views:
    224
  3. aditya

    how the following printf statement works

    aditya, Oct 29, 2004, in forum: C Programming
    Replies:
    9
    Views:
    451
    Joona I Palaste
    Oct 29, 2004
  4. Readon Shaw

    what does this statement means?

    Readon Shaw, Nov 16, 2006, in forum: C Programming
    Replies:
    1
    Views:
    324
    Richard Heathfield
    Nov 16, 2006
  5. Chad
    Replies:
    12
    Views:
    635
Loading...

Share This Page