[M3devel] uid == 0?

Jay K jay.krell at cornell.edu
Wed Sep 15 14:59:17 CEST 2010


It'd be super convenient if uid == 0 was invalid.
But then, whey is NO_UID = 0xFFFFFFFF?

You know, I recently introduced:
typedef struct GTY(()) m3type
{
  unsigned long id;
  tree GTY(()) t;
} m3type_t;

I think it might be useful to flesh this out a bunch, like:

typedef struct GTY(()) m3type
{
  unsigned long id;
  tree GTY(()) t;
  /* conceptually a union */
  unsigned is_packed : 1;
  unsigned is_record : 1;
  unsigned is_enum : 1;
  unsigned is_object : 1;
  struct
  {
    unsigned size;
    unsigned long target_id;
  } packed;
} m3type_t;

or:

typedef struct GTY(()) m3type

{

  unsigned long id;

  tree GTY(()) t;

  /* conceptually a union */

    unsigned packed_size; (* or zero *)

    unsigned long packed_target_id; (* or zero *)
} m3type_t;



 - I think t will often have this information, but not always, like how to discern object from record?
   Maybe it doesn't matter?
 - the gcc garbage collector might require more annotations for unions and I'd rather defer that
 - but there will be many of these (thousands?)
 - I'm lately a non-fan of bitfields in C, because I can't predict the layout easily.



 - Jay

 		 	   		  


More information about the M3devel mailing list