Path: utzoo!mnetor!uunet!seismo!sundc!pitstop!sun!aeras!dgcad!roger From: roger@dgcad.UUCP (Roger Scott) Newsgroups: comp.lang.c++ Subject: Re: Cfront output (partly) explained Message-ID: <97@dgcad.UUCP> Date: 29 Feb 88 19:31:53 GMT References: <542@acf3.NYU.EDU> Reply-To: roger@hotlips.UUCP (Roger Scott) Distribution: na Organization: Data General Corp., Sunnyvale, CA. Lines: 43 In article <542@acf3.NYU.EDU> pedersen@acf3.UUCP (paul pedersen) writes: >Sorry to post this, but megatest.UUCP and riacs.ARPA are both unknown to my >mailer. > >In article <275@goofy.megatest.UUCP> you write: >> >>A while back, I asked what bad things would happen if I hacked cfront ... > >The reason for prefixing field names with struct names is to handle old >C compilers, ... > >I can't account for the "au0_" prefixes, but probably the reason is something >similar: handling old C compilers. > Sorry, but this explanation is wrong on both counts. Structure member names are prefixed with the structure name in order to handle the following case: struct base { int bb; }; struct derived : base { int bb; // perfectly legal int dd; void f(); }; void derived::f() {base::bb = bb;} base::bb and derived::bb can't very well be called the same thing in the C code. If you do not use this marginally useful ``feature'', you can make a trivial change to print.c to fix this. If you don't have source access, but you are adventuresome, you can modify the symbol table info in the a.out file (for dbx) [write me if you want to know more]. As for _au0, etc., it is used to handle a similarly marginal feature: int x; void foo() { int x = ::x; // remember the ol' scope resolution operator? // ... } Again, if you don't use this you can eliminate the _au0. p.s. - if you think things are bad now, wait 'till you see what 2.0 does to names.