const int versus #define - does "const int" take up space in exe?

T

ThazKool

I know that the "const int" declaration gives us more control with
scoping. However if I make a file with thousands of const int
declarations, will this increase exe size if I do not use them? I know
that #define will only get used if the preprocessor encounters one.

Thanks,
ThazKool
 
S

sandravandale

ThazKool said:
I know that the "const int" declaration gives us more control with
scoping. However if I make a file with thousands of const int
declarations, will this increase exe size if I do not use them? I know
that #define will only get used if the preprocessor encounters one.

Thanks,
ThazKool

Any semi-competent compiler should optimize away all the const ints you
don't use, so I wouldn't worry about it.

-Sandra
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,434
Messages
2,571,685
Members
48,796
Latest member
Greg L.

Latest Threads

Top