Skip to contentSkip to conversation

class Q_CORE_EXPORT QFlag

DISCUSSION Shriramana Sharma 4 participants 6 messages May 1, 2007 – May 15, 2007

lore
Share & tools
lore
#0 lore raw

I see many usages in the Qt sources like:

class Q_CORE_EXPORT QFlag
{
<blah blah blah>
} ;

Isn't the word immediately next to the keyword class supposed to be the class name? Q_CORE_EXPORT etc are certainly not class names. What are they and how are they allowed in between the word class and the class name?

I searched my "Thinking in C++" for this but did not turn up an answer. Please help.

Thanks as always,

Shriramana Sharma.

#1 lore raw
Quoted 8 lines · Shriramana Sharma

I see many usages in the Qt sources like:

class Q_CORE_EXPORT QFlag { <blah blah blah> } ;

Isn't the word immediately next to the keyword class supposed to be the class name? Q_CORE_EXPORT etc are certainly not class names. What are they and how are they allowed in between the word class and the class name?

It's either a C preprocessor symbol defined somewhere else, or, what's more likely, a MOC preprocessor symbol.

Leslie

Signature · 2 lines
Personal homepage: https://viridian.dnsalias.net/~sky/homepage/
gpg --keyserver pgp.mit.edu --recv-keys DD4EBF83
#2 lore raw
In reply to Shriramana Sharma
Quoted 7 lines · Shriramana Sharma

I see many usages in the Qt sources like:

class Q_CORE_EXPORT QFlag
{
<blah blah blah>
} ;

Quoted 6 lines

Isn't the word immediately next to the keyword class supposed to be the class name? Q_CORE_EXPORT etc are certainly not class names. What are they and how are they allowed in between the word class and the class name?

I searched my "Thinking in C++" for this but did not turn up an answer. Please help.

It's a macro that expands with different results depending on the platform and/or context. For example when building Qt applications on a Windows machine, it's redefined to Q_DECL_EXPORT which, in this case, expands to __declspec(dllexport). See /src/corelib/global/qglobal.h in the Qt source tree.

\Steve

--

Steve Grägert <[email protected]>
Jabber xmpp://[email protected]
-
To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#3 lore raw

Thanks Leslie and Steve. It did not occur to me that it would be something MOC takes care of.

I need to read up on what these mangled __ symbols mean. I have seen some in glibc sources (just perused a few files) especially things like __throw -- probably flags to the C++ compiler indicating what a particular class or function or whatever behaves like, yes?

Shriramana Sharma.

#4 lore raw
Quoted 1 line · Shriramana Sharma

I need to read up on what these mangled __ symbols mean.

Um I am at a loss to where to start... Can anyone point me to good reading on this topic? Thanks.

Shriramana Sharma.

#5 lore raw
In reply to Shriramana Sharma
Quoted 7 lines · Shriramana Sharma

Thanks Leslie and Steve. It did not occur to me that it would be something MOC takes care of.

I need to read up on what these mangled __ symbols mean. I have seen some in glibc sources (just perused a few files) especially things like __throw -- probably flags to the C++ compiler indicating what a particular class or function or whatever behaves like, yes?

Identifiers beginning with an underscore are reserved for the "implementation", i.e. the compiler and/or standard libraries (libc and libm). Specifically:

-- All identifiers that begin with an underscore and
either an uppercase letter or another underscore are always reserved for any use.

-- All identifiers that begin with an underscore are
always reserved for use as identifiers with file scope in both the ordinary and tag name spaces.

Most of them will be documented in the Info files for gcc and glibc.

Signature · 1 line
Glynn Clements <[email protected]>