c++ - Difference between Enum and Define Statements -


What is the difference between a defined statement in C / C ++ and an enum statement (and any differences when using it Either C or C ++)?

For example, when using

  enum {BUFFER = 1234};  

more

  define # buffer 1234  

enum defines a syntax element.

, sees first compiler code, and therefore does not have a language element of C.

Generally, these are preferred because they are type-safe and more easily searchable. To define, it is hard work and can be complicated behavior, for example a piece of code can redefine any other code by #define . It can be difficult to track.


Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -