Thread: Is enum from the C programming language?

  1. #1
    Banned
    Join Date
    Jan 2003
    Posts
    1,708

    Is enum from the C programming language?

    I have been looking through the original GL quake gaming engine, and it's completely written in C(edit: also x86 asm). There are a lot of #defines, and instead of using the #defines enumerated constants could've been used instead, unless of course enum isn't a part of the C programming language.

  2. #2
    Skunkmeister Stoned_Coder's Avatar
    Join Date
    Aug 2001
    Posts
    2,572
    yes c has enums but they are not quite the typesafe enums of c++
    Free the weed!! Class B to class C is not good enough!!
    And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi

  3. #3
    Banned
    Join Date
    Jan 2003
    Posts
    1,708
    could you elaborate with an example or something?

  4. #4
    Skunkmeister Stoned_Coder's Avatar
    Join Date
    Aug 2001
    Posts
    2,572
    in c an enum is seen by the compiler as an int. in c++ the enum is a distinct type.
    Free the weed!! Class B to class C is not good enough!!
    And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi

  5. #5
    Banned
    Join Date
    Jan 2003
    Posts
    1,708
    enums in C++ are still assigned integer values though.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. What language did they make Java in?
    By jverkoey in forum A Brief History of Cprogramming.com
    Replies: 17
    Last Post: 07-03-2005, 04:18 PM
  2. Strange loop
    By D@rk_force in forum C++ Programming
    Replies: 22
    Last Post: 12-18-2004, 02:40 PM
  3. assembly language...the best tool for game programming?
    By silk.odyssey in forum Game Programming
    Replies: 50
    Last Post: 06-22-2004, 01:11 PM
  4. Language of choice after C++
    By gandalf_bar in forum A Brief History of Cprogramming.com
    Replies: 47
    Last Post: 06-15-2004, 01:20 AM
  5. Languages dying
    By Zewu in forum A Brief History of Cprogramming.com
    Replies: 31
    Last Post: 07-29-2003, 10:08 AM