Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: sigra at home dot se
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29208
--- Comment #2 from sigra at home dot se 2006-09-24 23:29 ---
Sorry, accidentally hit commit too early. Try again:
There should be a warning about unchecked use of pointers in C++. For example:
void f(T * const x) {
x-something... // x might be 0, warn.
}
void f(T * const x
--- Comment #4 from sigra at home dot se 2006-09-24 23:57 ---
(In reply to comment #3)
some functions require non zero pointers and those should crash instead of
having null pointer checks on them. And using references is not always the
answer as some functions need to be able
: enhancement
Priority: P3
Component: other
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: sigra at home dot se
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29768
--- 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
++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: sigra at home dot se
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25845
--- Comment #2 from sigra at home dot se 2006-01-18 16:07 ---
Example 1:
{
int i = f();
do_something(i + 1, 7, 'h');
do_something_else(i % 3, 'e');
}
If i could be declared const int, the compiler should warn.
Example 2:
float dra(float m, Panel p) {
p.do_me(5);
return
--- Comment #5 from sigra at home dot se 2006-01-18 16:25 ---
(In reply to comment #3)
I still don't understand what this warning is useful for?
const does nothing when it comes to local variables except for not letting
you touch it in other expressions. It does nothing
--- Comment #8 from sigra at home dot se 2006-01-18 19:29 ---
On Jan 18, 2006, at 11:19 AM, pcarlini at suse dot de wrote:
--- Comment #4 from pcarlini at suse dot de 2006-01-18 16:19
---
(In reply to comment #3)
const does nothing when it comes to local variables
--- Comment #13 from sigra at home dot se 2006-01-18 20:41 ---
It does not make any sense to require the compiler to give a warning
in that case.
Read the subject again: optional
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25845
--- Comment #14 from sigra at home dot se 2006-01-18 20:49 ---
Isn't this a task for lint-like tool? GCC isn't such thing.
Are you sure? http://directory.fsf.org/GNU/gcc.html says: GCC provides many
levels of source code error checking traditionally provided by other tools
--- Comment #17 from sigra at home dot se 2006-01-18 23:23 ---
There is some good advice at http://www.gotw.ca/publications/advice98.htm which
says that one should be const-correct and use const whenever possible. (But I
do not suggest using const for return values.) This feature
: 4.1.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: sigra at home dot se
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30521
Version: 4.1.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: sigra at home dot se
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31238
14 matches
Mail list logo