Path: utzoo!censor!geac!torsqnt!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!uunet!jarthur!mti!adrian From: adrian@mti.mti.com (Adrian McCarthy) Newsgroups: comp.lang.c Subject: Re: Addressing struct without -> Message-ID: <1290@mti.mti.com> Date: 15 Jan 91 18:34:19 GMT References: <91010.084408NIBMSCM@NDSUVM1.BITNET> <14822@smoke.brl.mil> Reply-To: adrian@mti.UUCP (Adrian McCarthy) Organization: Micro Technology, Anaheim, CA Lines: 26 In article <14822@smoke.brl.mil> gwyn@smoke.brl.mil (Doug Gwyn) writes: >... C is not Pascal; it is better. ... Let's not start that flame war. The application to be implemented usually determines which language is best. > The whole "using" [Pascal with] approach is insufficiently general, since > in C different structure types can have the same member names, and often >do in practical source code. You can have identically named fields in Pascal records too (some non-standard compilers don't allow it). Some older C compilers have problems with it, too. Aren't the fields in a struct tm are all prefixed with tm_ to reduce the chances of a name-space conflict? What bothers me about x.y and x->y is that I shouldn't *in many cases* have to worry about whether x is an instance of a struct or a pointer to one. If I have a function that works with a struct, and I change my mind about how to pass that struct into the function (e.g., by value instead of by reference), it's irritating to have to mindlessly change all the occurences of x->y to x.y and all of the calls of that function to remove the &'s. The mindless stuff should be done by the machine. In this regard, C constantly makes you worry about the low-level details when it would be more productive to think in abstract terms. Aid. (adrian@gonzo.mti.com)