how is const better compared to #define

micsom's Avatar, Join Date: Oct 2008
Go4Expert Member
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
xpi0t0s's Avatar, Join Date: Aug 2004
Mentor
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?
micsom's Avatar, Join Date: Oct 2008
Go4Expert Member
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.

xpi0t0s's Avatar, Join Date: Aug 2004
Mentor
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.