Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watmath!clyde!rutgers!rochester!PT.CS.CMU.EDU!F.GP.CS.CMU.EDU!rpd From: rpd@F.GP.CS.CMU.EDU.UUCP Newsgroups: comp.lang.c Subject: Re: Question on structures Message-ID: <295@PT.CS.CMU.EDU> Date: Tue, 3-Nov-87 16:47:48 EST Article-I.D.: PT.295 Posted: Tue Nov 3 16:47:48 1987 Date-Received: Sat, 7-Nov-87 08:13:01 EST References: <1025@phoenix.Princeton.EDU> <2986@mit-vax.LCS.MIT.EDU> <5673@weitek.UUCP> <3048@psuvax1.psu.edu> Sender: netnews@PT.CS.CMU.EDU Organization: Carnegie-Mellon University, CS/RI Lines: 25 The topic under discussion is the Pascal WITH statement and C equivalents. Dan Rober points out that, in C, it is easy to declare a local pointer variable and initialize it with the address of the structure to be manipulated. He claims that this approach avoids ambiguities present in the WITH statement. Scott Schwartz isn't convinced and feels that "Anyone framiliar [sic] with nested block structured languages should have no problem with this." I have to agree with Dan's position. In my experience, every WITH statement is a mystifying bug waiting to happen. Consider the following fragment of code: VAR foo : integer; BEGIN WITH a.b.c DO foo = bar + baz END; where bar & baz are fields of a.b.c. This is code buried in some obscure long-forgotten part of your program. Now you decide to add a new field to a.b.c, and call it foo. All of a sudden that old code which you didn't touch and certainly didn't think to look at stops working. The upshot is that by using WITH the programmer throws away the advantages that block structure is supposed to give him. Rich