Enumerators seem like an unneeded stock c++ convention

This is a discussion on Enumerators seem like an unneeded stock c++ convention within the C++ Programming forums, part of the General Programming Boards category; I'm just learning, but at this point it seems to me that there isn't a difference between an enumerator and ...

  1. #1
    Registered User
    Join Date
    Aug 2012
    Posts
    19

    Enumerators seem like an unneeded stock c++ convention

    I'm just learning, but at this point it seems to me that there isn't a difference between an enumerator and creating you own data type of the "typedef const unsigned int" format. Am I not seeing the full picture?

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    21,717
    Quote Originally Posted by Delicieuxz
    I'm just learning, but at this point it seems to me that there isn't a difference between an enumerator and creating you own data type of the "typedef const unsigned int" format. Am I not seeing the full picture?
    A distinctive difference is that an enumeration declaration, um, enumerates the various permitted values, even though this is not enforced by the compiler, whereas a simple typedef does not.
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    Algorithm Dissector iMalc's Avatar
    Join Date
    Dec 2005
    Location
    New Zealand
    Posts
    6,304
    "enumerators", as in things that enumerate?!
    Perhaps you mean "enumerations"?

    I'm sure we don't really need to go over this again. You must be perfectly capable of searching for the dozen or so existing thread on this site asking the same question, or on the rest of the interwebs for that matter.
    My homepage
    Advice: Take only as directed - If symptoms persist, please see your debugger

    Linus Torvalds: "But it clearly is the only right way. The fact that everybody else does it some other way only means that they are wrong"

  4. #4
    Registered User
    Join Date
    Aug 2012
    Posts
    19
    Quote Originally Posted by laserlight View Post
    A distinctive difference is that an enumeration declaration, um, enumerates the various permitted values, even though this is not enforced by the compiler, whereas a simple typedef does not.
    Ah, right. I didn't grasp that part while studying earlier. It clicked afterwards. Thanks.

    Quote Originally Posted by iMalc View Post
    "enumerators", as in things that enumerate?!
    Perhaps you mean "enumerations"?

    I'm sure we don't really need to go over this again. You must be perfectly capable of searching for the dozen or so existing thread on this site asking the same question, or on the rest of the interwebs for that matter.
    When you're genuinely learning, you often either feel that your question is idiosyncratic, or are unsure of how it would be phrased in a manner which would cover what you're confused about - and your corrective distinction between enumerators and enumerations helps drive that point home. Although, my use of enumerator instead of enumeration was correct. I wasn't asking regarding the concept of enumeration (considering I wasn't then aware of the actual enumeration that was taking place), but the point of the existence of the "enum" keyword, which does enumeration but which is an enumerator, in lieu of making ones own identical new date type with typedef. I see the difference now.
    Last edited by Delicieuxz; 08-21-2012 at 06:14 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Enumerators vs Magic no.s
    By manasij7479 in forum C++ Programming
    Replies: 11
    Last Post: 05-24-2011, 01:08 AM
  2. Enumerators as strings
    By Mario F. in forum C++ Programming
    Replies: 14
    Last Post: 07-19-2006, 01:26 PM
  3. unneeded includes
    By Laserve in forum C Programming
    Replies: 3
    Last Post: 12-13-2005, 06:24 PM
  4. Replies: 2
    Last Post: 01-04-2003, 12:16 AM
  5. darn enumerators...please help
    By Waldo2k2 in forum A Brief History of Cprogramming.com
    Replies: 2
    Last Post: 06-08-2002, 07:11 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21