Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / October 2007

Tip: Looking for answers? Try searching our database.

"const" not used in VC .NET

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Surmeet Jandu - 12 Oct 2007 06:49 GMT
Hi,
Can any body tell me that instead of "const" what can we use in MC++.
Thanks in advance!!
Ben Voigt [C++ MVP] - 12 Oct 2007 17:43 GMT
> 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.
Peter Oliphant - 15 Oct 2007 17:52 GMT
> 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==]

> Hi,
> Can any body tell me that instead of "const" what can we use in MC++.
> Thanks in advance!!
Larry Smith - 16 Oct 2007 02:02 GMT
> 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

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.