glenne@HPLSLA.HP.COM (Glenn Engel) (06/10/89)
When enums are printed with gdb, gdb will show the string which represents the enum. If two enums have the same value, the last one defined will be printed. I think it would be more useful to default to the first string rather than the last string. Here's an example: typedef enum { ABLOB, BBLOB, CBLOB, DBLOB, FIRST_BLOB = ABLOB, LAST_BLOB = DBLOB, NUM_BLOBS = LAST_BLOB - FIRST_BLOB +1, } Blobs; main() { Blobs blob,aBlob; blob = DBLOB; for (aBlob = FIRST_BLOB; blob <= LAST_BLOB; blob++) { /* do something interesting */ } } If blob is printed with gdb, it will say it is equal to LAST_BLOB instead of DBLOB. Also, when aBlob is printed during the for loop, it will come up with values of FIRST_BLOB and LAST_BLOB instead of ABLOB and DBLOB. -- | Glenn R. Engel | Hewlett-Packard | (206) 335-2066 | glenne%hplsla@hplabs.hp.com