[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
No return value, but no warning?
From: |
Jack Applin |
Subject: |
No return value, but no warning? |
Date: |
Thu, 08 Mar 2001 22:35:49 GMT |
User-agent: |
tin/1.5.7-20001104 ("Paradise Regained") (UNIX) (FreeBSD/4.2-STABLE (i386)) |
Consider this program fragment:
class foo {
public:
~foo() {}
};
double alpha(foo f) { }
class bar {
};
double beta(bar b) { }
Compiling with g++ 2.95.2 produces:
$ g++ -ansi -pedantic -Wall -W -c c.c
c.c: In function `double beta(bar)':
c.c:11: warning: unused parameter `class bar b'
c.c:11: warning: control reaches end of non-void function `beta(bar)'
Why didn't alpha produce any warnings? I suppose that, because foo
isn't POD, it can have an "active" copy ctor and dtor, and hence f is
implicitly used, so it's ok to omit the warning about an unused parameter.
However, why no warning about alpha not returning anything?
--
Jack Applin
address@hidden
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- No return value, but no warning?,
Jack Applin <=