Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [cdt-dev] AST: How to discover when ICPPClassType is C-structure orwhen it is true class?

The only difference between classes and structs in c++ is that members
and bases of structs are public by default, so this behaviour seems
reasonable.

You can use ICompositeType.getKey() and compare the result with
ICompositeType.k_struct to test (ICPPClassType extends ICompositeType).

Regards,
s

> -----Original Message-----
> From: cdt-dev-bounces@xxxxxxxxxxx [mailto:cdt-dev-bounces@xxxxxxxxxxx]
On
> Behalf Of Andrey Tretyakov
> Sent: Thursday, April 16, 2009 4:14 PM
> To: Schorn, Markus
> Cc: CDT General developers list.
> Subject: [cdt-dev] AST: How to discover when ICPPClassType is
C-structure
> orwhen it is true class?
> 
> Good day!
> 
> CDT AST confuses ICompositeType with ICPPClassType for structures in
C++
> programs:
> Foe example, I have the following "C" program:
> 
> struct tst {
> 	int a;
> 	int b;
> };
> 
> int main()
> {
> 	return 0;
> }
> 
> I get IASTName for "tst", then IBinding for it, and it is instanceof
> ICompositeType in this case. That's OK.
> But when I create "C++" program with the same content, IBinding is
> instanceof ICPPClassType!
> Then, how to distinguish these types:
> 
> struct tst {
> 	int a;
> 	int b;
> };
> 
> and
> 
> class tst {
> 	int a;
> 	int b;
> };
> 
> ???
> 
> Thanks for any help.
> 
> Best regards,
>                Andrey.
> _______________________________________________
> cdt-dev mailing list
> cdt-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/cdt-dev 
 
*******************************
This e-mail contains information for the intended recipient only.  It may contain proprietary material or confidential information.  If you are not the intended recipient you are not authorised to distribute, copy or use this e-mail or any attachment to it. Murex cannot guarantee that it is virus free and accepts no responsibility for any loss or damage arising from its use.  If you have received this e-mail in error please notify immediately the sender and delete the original email received, any attachments and all copies from your system.


Back to the top