This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [rfa] space reduction in gdbtypes.h


Andrew C says:


 #define BOUND_BY_REF_IN_REG          2
 #define BOUND_BY_VALUE_IN_REG        1
 #define BOUND_SIMPLE                 0
-  int upper_bound_type;
-  int lower_bound_type;
+  int upper_bound_type : 4;
+  int lower_bound_type : 4;

Hmm, doesn't this part scream ENUM?


I agree, it does, but I wanted to patch one thing at a time,
so I left it as an int.

Try a different ordering of the changes:


- make the cleanups first (no functional change)
- make the functional change last (here reducing the size of the gdb footprint)


Without that the packing is unsafe: adding an extra variant that overflows the field won't be detected; compilers capable of checking enum assignments won't do anything useful.


Well, the definitions are right next to the use, which would make
it obvious.

People have this habit of taking shortcuts when ever possible -> it's never obvious :-(


Would you like me to go ahead and make this an enum right now?

Yes please. Macro's are bad m'kay.


Andrew


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]