comp.lang.ada
 help / color / mirror / Atom feed
From: "Markus Schöpflin" <no.spam@spam.spam>
Subject: Re: Simple Warnings Needs
Date: Thu, 24 Feb 2011 09:26:35 +0100
Date: 2011-02-24T09:26:35+01:00	[thread overview]
Message-ID: <ik54np$vq0$1@speranza.aioe.org> (raw)
In-Reply-To: 8b826007-6846-4477-a6e0-91ad08b32bc7@p12g2000vbo.googlegroups.com

Am 23.02.2011 22:55, schrieb Martin:

[...]

> I seem to remember an article by Dewar explaining why constants can
> rarely be optimized but I can't put my finger on it at the moment...

There has been a GOTW article about this. It of course discusses C++, but 
most statements are also valid for other languages. See 
http://www.gotw.ca/gotw/081.htm.

To quote from it's summary at the end:

<quote>
It's a common belief that const-correctness helps compilers generate 
tighter code. Const is indeed a Good Thing, but the point of this issue of 
GotW is that const is mainly for humans, rather than for compilers and 
optimizers. When it comes to writing safe code, const is a great tool that 
lets programmers write safer code with compiler checking and enforcement. 
Even when it comes to optimization, const is still principally useful as a 
tool that lets human class designers better implement handcrafted 
optimizations, and less so as a tag for omniscient compilers to 
automatically generate better code.
</quote>

Markus



  reply	other threads:[~2011-02-24  8:26 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-23 18:52 Simple Warnings Needs Rego
2011-02-23 19:56 ` mockturtle
2011-02-23 23:07   ` jpwoodruff
2011-02-23 20:06 ` Ludovic Brenta
2011-02-23 21:55 ` Martin
2011-02-24  8:26   ` Markus Schöpflin [this message]
2011-02-26  3:51     ` Rego
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox