how is const better compared to #define

Go4Expert Member
5Apr2010,13:40   #1
micsom's Avatar
Its said that using const is better compared to #define...because const identifier uses compiler symbol table..

can some1 please explain why? and How?...

Thanks
Mentor
6Apr2010,13:01   #2
xpi0t0s's Avatar
Lots of answers to and discussions about this online. http://lmgtfy.com/?q=compare+const+define
Why do you need to start yet another thread about it?
Go4Expert Member
6Apr2010,13:10   #3
micsom's Avatar
thanks for the reply..i am actually interested in how symbol table comes into the picture for const and #define...

i was googling for it when i came across it..but i didn't find any satisfactory answers.

Mentor
6Apr2010,13:11   #4
xpi0t0s's Avatar
const defines a variable which goes into the compiler's symbol table with all other variables. #define is just a lexicographical thing sorted out by the parser; the compiler never sees #defines.