Package: g++-3.3 Version: 1:3.3.3-1 Severity: wishlist
It would be nice if there was an option to add a warning about "useless" casts. Although they are not really incorrect, they might become incorrect/inefficient as the program evolves. Ie; struct A { int a; }; struct B : A { int b; }; void func(A *a) { ++a; } int main(int ac, char **av) { A a; B b; func((A*)&a); // Useless cast since a already is an A. func(static_cast<A*>(&a)); // Just as useless. func((A*)&b); // Useless cast since b is a kind of A. func(static_cast<A*>(&b)); // Just as useless. return 0; } -- System Information: Debian Release: testing/unstable APT prefers testing APT policy: (990, 'testing'), (500, 'unstable'), (1, 'experimental') Architecture: i386 (i686) Kernel: Linux 2.4.21-xfs Locale: LANG=sv_SE, LC_CTYPE=sv_SE Versions of packages g++-3.3 depends on: ii gcc-3.3 1:3.3.3-1 The GNU C compiler ii gcc-3.3-base 1:3.3.3-1 The GNU Compiler Collection (base ii libc6 2.3.2.ds1-11 GNU C Library: Shared libraries an ii libstdc++5-3.3-dev 1:3.3.3-1 The GNU Standard C++ Library v3 (d -- no debconf information