469,319 Members | 2,421 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,319 developers. It's quick & easy.

What following statement means?

//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

Jul 23 '05 #1
2 1300
we*****@yahoo.com 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
Jul 23 '05 #2
In message <11**********************@z14g2000cwz.googlegroups .com>,
we*****@yahoo.com 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
Jul 23 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

220 posts views Thread by Brandon J. Van Every | last post: by
54 posts views Thread by Brandon J. Van Every | last post: by
29 posts views Thread by asj | last post: by
12 posts views Thread by Steven T. Hatton | last post: by
12 posts views Thread by prashna | last post: by
4 posts views Thread by Tina | last post: by
669 posts views Thread by Xah Lee | last post: by
11 posts views Thread by antonyliu2002 | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
reply views Thread by Gurmeet2796 | last post: by
reply views Thread by mdpf | last post: by
reply views Thread by listenups61195 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.