[Prev][Next][Index]
Distinguishing a structure from a typedef
- Date: Tue, 11 Oct 1994 23:06:31 -0600 (MDT)
- From: Diego Novillo <diego@cs.ualberta.ca>
- To: Sage Users List <sage-users@cica.indiana.edu>
- Subject: Distinguishing a structure from a typedef
Hi,
I'm having some difficulties with user defined types in Sage.
Suppose that the user writes the following code:
typedef int Offset;
struct someStruct {
...
};
typedef struct someStruct Type;
main()
{
Offset a;
Type b;
}
Sage defines both 'a' and 'b' to be of type T_DERIVED_TYPE. Now, I need
to know whether 'a' or 'b' is really a structure.
What I do is use SgType::symbol() to obtain the symbol for the type and
to that symbol I ask the number of fields it has.
For 'a' I get back 0 and for 'b' I get back whatever number of fields
the structure has.
I tried using other approaches like using SgType::baseType() and
SgType::getTrueType() but I couldn't get them to work. Does anyone has
any suggestion on a better way of doing this?
Thanks. Diego.
--
Diego A. Novillo | "We each pay a fabulous price for our
diego@cs.ualberta.ca | visions of paradise. But a spirit with
Computing Science - U of Alberta | a vision is a dream with a mission"
Edmonton, Alberta - Canada | Rush - Mission