[cfe-dev] C vs. C++: Inconsistent type classifications

Doug Gregor doug.gregor at gmail.com
Thu Nov 20 15:09:35 PST 2008


On Thu, Nov 20, 2008 at 5:56 PM, Chris Lattner <clattner at apple.com> wrote:
> On Nov 20, 2008, at 2:46 PM, Doug Gregor wrote:
>> Personally, I favor following the C++ semantics,
>
> Hehe, big surprise ;-)

:)

>> because I find the
>> C++ classifications more natural ("integer" type doesn't scream
>> "enumeration" for me, and whether or not we've seen a definition for a
>> type shouldn't affect what kind of type it is), and of course, in the
>> long run, the majority of the code in Clang is going to go toward
>> supporting C++.
>
> Is there any case where the C++ definition is less restricted than the C
> version?

Yeah, the definition of an object type in C++ includes incomplete
types, but the C definition does not include incomplete types, so C is
more restrictive in this case.

I may end up having to restructure some of the checks for incomplete
types (since they are implicit in isObjectType now) as part of making
this change. As you noted, it'll take a bit of care to get the
semantics right. However, I'll use this as an excuse to audit those
parts of the code to make sure they're doing the right thing for both
C and C++ (since they're bound to be C-centric now).

  - Doug



More information about the cfe-dev mailing list