What following statement means?

W

wenmang

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

Victor Bazarov

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

Richard Herring

In message said:
//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.
 

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,537
Members
45,023
Latest member
websitedesig25

Latest Threads

Top