Topic: unsigned enums


Author: F.van.Hoesel@chem.rug.nl (Frans van Hoesel)
Date: 1996/07/14
Raw View
Just wondering....
what might be the reson of not allowing unsigned enums?

pretty useful in code as
typedef unsigned enum { option1, option2, option3, option4 } options;

struct {
 options:2;
 unsigned int other:30;
 } testing;

main () {
 testing.options = option4;

 if (testing.options == option4) {
  // won't work because enums are signed
 }
}

  _______________________________________________________________

    "Hi, my name is Frans, I'm your crazy scientist for today."

    Frans van Hoesel          hoesel@chem.rug.nl
                              http://rugmd4.chem.rug.nl/hoesel
  _______________________________________________________________
---
[ comp.std.c++ is moderated.  To submit articles: try just posting with      ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu         ]
[ FAQ:      http://reality.sgi.com/employees/austern_mti/std-c++/faq.html    ]
[ Policy:   http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
[ Comments? mailto:std-c++-request@ncar.ucar.edu                             ]