Question

typedef const struct __CFString * a1;

In the above typedef declaration says a1 is defined as a pointer to constant structure __CFString.

Here what does "__" mean?

Then I create a new definition as a2, described below.

typedef const struct CFString * a2;

So, how a1 is different from a2?

Was it helpful?

Solution

First of all, the underscores in __CFString are part of the name, so struct __CFString and struct CFString are different types, just like struct XXCFString and struct CFString are different types.

Second, any name starting with a double underscore is reserved for the implementation. In other words, you can't use names that start with a double underscore without risking a name collision.

Here's another SO answer with more details: What are the rules for using an underscore in a C++ identifier?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top