Path: utzoo!mnetor!uunet!husc6!cmcl2!acf3!pedersen From: pedersen@acf3.NYU.EDU (paul pedersen) Newsgroups: comp.lang.c++ Subject: Cfront output (partly) explained Message-ID: <542@acf3.NYU.EDU> Date: 23 Feb 88 00:20:58 GMT Reply-To: pedersen@acf3.UUCP (paul pedersen) Distribution: na Organization: New York Univsersity Lines: 31 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 so >that it does not prefix automatic variables with au0_, etc. >Nobody said anything. You may have thought I was jesting. >I was serious. Stop me if I'm going to break something. Really. >Also cfront changes the field names in structs, prefixing >the name of the struct. What if I change it so that it doesn't do that? > >Please comment. > > > Dave Jones > ARPA: megatest!djones@riacs.ARPA The reason for prefixing field names with struct names is to handle old C compilers, which barf if more than one struct uses a given field name. When K&R was written, this was standard C behavior, and any variable whatever could be qualified with the "." operator, followed by any structure member name whatever. More modern compilers restrict the use of member names, allowing them to follow only structures (using ".") or structure pointers (using "->") of the proper type, and therefore allowing the same member name to appear in more than one struct. See K&R page 209 (the C reference manual, section 14.1). I can't account for the "au0_" prefixes, but probably the reason is something similar: handling old C compilers.