This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [cs] Robustify in the presence of PCH n snarf-n-barf
- From: Mike Stump <mrs at apple dot com>
- To: Geoff Keating <geoffk at geoffk dot org>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Thu, 30 Oct 2003 15:54:58 -0800
- Subject: Re: [cs] Robustify in the presence of PCH n snarf-n-barf
On Thursday, October 30, 2003, at 01:14 PM, Geoff Keating wrote:
This change is wrong, please make sure it never gets into mainline GCC.
Please explain how one can have two pointers to the same piece of GCed
data that have different static types on them?
In C++, this would be:
class Base {
} *base;
class Derived : public base {
} *derived;
int main() {
base = derived = new Derived;
}
In C, this would be:
tree base;
tree_decl derived;
int main() {
base = derived = make_decl ();
return 0;
}
Per and I are experimenting with tightening up the compiler to include
more static typing, so that we can have the compiler's static type
system diagnose type errors instead of depending upon DECL_CHECK as
much. This aids readability, give type violations sooner, and has
other good benefits.
The C++ runtime system has the exact same code as your PCH code, but,
it does all the required runtime conversions, unlike your code. Please
explain why your code isn't just plain wrong.