• Create Account

### #ActualKhatharr

Posted 11 February 2013 - 03:05 PM

'array' is a keyword in C++ IIRC, so it's a good habit to not use it as a variable name. Rather than using #define to define constants it's better to just make constants:
const size_t SIZE = 10;
This gives you type control and avoids macro expansion problems like the one you encountered.

Using #define is almost the same as using your a text editor's 'find-and-replace' function. There are some cases where it's useful, but usually it causes more problems than it solves.

### #1Khatharr

Posted 11 February 2013 - 03:04 PM

'array' is a keyword in C++ IIRC, so it's a good habit to not use it as a variable name. Rather than using #define to define constants it's better to just make constants:<pre class="_prettyXprint _lang-auto _linenums:0">const size_t SIZE = 10;</pre>This gives you type control and avoids macro expansion problems like the one you encountered.<br /><br />Using #define is almost the same as using your a text editor's 'find-and-replace' function. There are some cases where it's useful, but usually it causes more problems than it solves.

PARTNERS