A strange C++ class declaration -
have read thread in stackoverflow: strange class declaration , still confused below code in foo.h
:
class foo checkleakdcl {
i sure foo should class name, since there constructor , deconstructor can imply this.
i cannot see macro definition related checkleakdcl in .h file.
also confused answer strange class declaration , saying that:
q_core_export isn't identifier. it's platform-dependent macro, , it's used signal class that's intended used across library boundaries.
can give more explanation of this?
update:
found line in .h file, included in foo.h
:
#define checkleakdcl : private checkleak
so class declarition should :
class foo : private checkleak {
so foo
extending checkleak
, right?
if compile windows (using visual studio), highly possible evaluated 1 of microsoft specific linkage identifiers, dllexport
or dllimport
:
https://msdn.microsoft.com/en-us/library/81h27t8c.aspx
it used when create class exported dll or used dll in application, , dependig of it's either evaluated dllexport
(dll exporting class) or dllimport
(application importing class).
if compile gcc possibly evaluate 1 of gcc _-attribute__
s. such __attribute__ ((visibility ("default")))
(https://gcc.gnu.org/wiki/visibility)
these extensions core c++ provided compilers make tasks more achievable (https://gcc.gnu.org/onlinedocs/gcc/c_002b_002b-extensions.html)
edit
after updated answer ... well, have private inheritance class. please note, terrible macro have there because
#define checkleakdcl : private checkleak
adds :
in class declaration cannot use symbol anymore inherit base classes.
i'd recommend rid of macro altogether, if cannot, not use it, confuse code.
Comments
Post a Comment