468,133 Members | 1,475 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,133 developers. It's quick & easy.

"const" not used in VC .NET

Hi,
Can any body tell me that instead of "const" what can we use in MC++.
Thanks in advance!!
Oct 12 '07 #1
3 1190

"Surmeet Jandu" <Su**********@discussions.microsoft.comwrote in message
news:FE**********************************@microsof t.com...
Hi,
Can any body tell me that instead of "const" what can we use in MC++.
Thanks in advance!!
There is no alternative for managed code. .NET doesn't support
const-correctness.

If you want a symbolic constant, then C++/CLI has "literal". I don't know
what the Managed Extensions for C++ syntax is for that, but you should
upgrade to VC2005 anyway.

Oct 12 '07 #2
Can any body tell me that instead of "const" what can we use in MC++.
Thanks in advance!!
Common sense?! LOL

Seriously, 'const' theoretically can prevent some programming slip ups, but
there are things (such as some templated lists) that defy 'const' even when
used in operations that don't seem to change anything, since merely
referencing them causes them to change (not sure why, but I've seen this
happen). Thus, I've had a program jam packed with 'const' constraints in the
past, only to introduce a list array, forcing me to remove the 'const' from
anything that ever referenced the list, or referenced anything that
referenced the list, or referenced anything that referenced anything that
referenced the list, etc.

As such, I gave up on 'const' a long time ago, as it introduced more
headaches than removing problems, and now I just use... you guessed
it...common sense...! :)

[==Peter==]
"Surmeet Jandu" <Su**********@discussions.microsoft.comwrote in message
news:FE**********************************@microsof t.com...
Hi,
Can any body tell me that instead of "const" what can we use in MC++.
Thanks in advance!!

Oct 15 '07 #3
As such, I gave up on 'const' a long time ago, as it introduced more
headaches than removing problems, and now I just use... you guessed
it...common sense...! :)
http://www.gotw.ca/gotw/006.htm
Oct 16 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

12 posts views Thread by zealotcat | last post: by
2 posts views Thread by s88 | last post: by
4 posts views Thread by C. J. Clegg | last post: by
16 posts views Thread by recover | last post: by
7 posts views Thread by Luna Moon | last post: by
27 posts views Thread by didacticone | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.