<p>What's the difference between using a define statement and an enum statement in C/C++ (and is there any difference when using them with either C or C++)?</p>

<p>For example, when should one use</p>

<pre><code>enum {BUFFER = 1234}; 
</code></pre>

<p>over</p>

<pre><code>#define BUFFER 1234   
</code></pre>

```
enum
```
defines a syntactical element.
```
#define
```
is a pre-preprocessor directive, executed
before
the compiler sees the code, and therefore is not a language element of C itself.
Generally enums are preferred as they are type-safe and more easily discoverable.  Defines are harder to locate and can have complex behavior, for example one piece of code can redefine a
```
#define
```
made by another.  This can be hard to track down.