[Bug c++/25845] want optional warning for non-constant declarations that could be constant
sigra at home dot se
gcc-bugzilla@gcc.gnu.org
Sat May 13 08:45:00 GMT 2006
------- Comment #20 from sigra at home dot se 2006-05-13 08:44 -------
I see that the feature I asked for has been implemented in the Ada frontend of
GCC. This program:
with Ada.Text_IO; use Ada.Text_IO;
procedure Prov is
A : Natural := 0;
begin
Put_Line ("A =" & A'Img);
end Prov;
compiled with "gnatmake -gnatwa prov" will give the following warning:
prov.adb:3:04: warning: "A" is not modified, could be declared constant
Many thanks for this!
However I have to use other languages as well, especially C++. Therefore I want
the feature there too. You may think that Ada is for serious development while
C++ is just for ugly hacks and therefore does not need the kind of code
checking features that Ada has. But there are still people trying to do serious
development in C++. Why not try to make their work a little mor comfortable
too?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25845
More information about the Gcc-bugs
mailing list