Be const-correct!

A forum to store posts deemed exceptionally wise and useful
Post Reply
randomMesh
Posts: 1186
Joined: Fri Dec 29, 2006 12:04 am

Be const-correct!

Post by randomMesh »

We all know that writing const-correct code is important to write tighter, safer code that is easier to manage.
Here's a nice article i found which explains how to do so.
"Whoops..."
arras
Posts: 1622
Joined: Mon Apr 05, 2004 8:35 am
Location: Slovakia
Contact:

Post by arras »

Nice and simple article. Thanks :)
pippy3
Posts: 155
Joined: Tue Dec 15, 2009 7:32 am

Post by pippy3 »

Cool stuff. I never was sure where to use const functions before
kingdutch
Posts: 76
Joined: Tue Sep 02, 2008 7:01 am

Post by kingdutch »

I hate the fact you always come up with links in chat when I talk about something. However I shall, as always, read the article, thanks for sharing ;)
if (msg.getRubbishFactor() > rubbishLimit) { ignorePost(); cout << how it should be done << "\n"; }
d3jake
Posts: 198
Joined: Sat Mar 22, 2008 7:49 pm
Location: United States of America

Post by d3jake »

Good find! I've already been doing some of this, and I suppose it wouldn't hurt to go full out with it, when done correctly.
The Open Descent Foundation is always looking for programmers! http://www.odf-online.org
"I'll find out if what I deleted was vital here shortly..." -d3jake
ChaiRuiPeng
Posts: 363
Joined: Thu Dec 16, 2010 8:50 pm
Location: Somewhere in the clouds.. drinking pink lemonade and sunshine..

Post by ChaiRuiPeng »

kingdutch wrote:I hate the fact you always come up with links in chat when I talk about something. However I shall, as always, read the article, thanks for sharing ;)
:wink: dont be upset.

a fool is the man who passes down the best treasure of all, knowledge.
ent1ty wrote: success is a matter of concentration and desire
Butler Lampson wrote: all problems in Computer Science can be solved by another level of indirection
at a cost measure in computer resources ;)
Brainsaw
Posts: 1176
Joined: Wed Jan 07, 2004 12:57 pm
Location: Bavaria

Post by Brainsaw »

Nice article, thanks for sharing. I'll try to make my code const-correct in the future ;)
Dustbin::Games on the web: https://www.dustbin-online.de/

Dustbin::Games on facebook: https://www.facebook.com/dustbingames/
Dustbin::Games on twitter: https://twitter.com/dustbingames
Post Reply