Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #36975

Re: Looking for C's equivalent of Pascal's "with"

Newsgroups comp.lang.c
Date 2013-10-04 11:48 -0700
References <12de4151-32fd-4cb9-bb8a-affd0079db8d@googlegroups.com> <6f50bf15-bdba-4f24-8373-77c8cdebd15f@googlegroups.com> <l2kg3n$kcs$1@speranza.aioe.org>
Message-ID <bb6ed569-cd61-4eec-a41e-efda46add0f9@googlegroups.com> (permalink)
Subject Re: Looking for C's equivalent of Pascal's "with"
From Fred K <fred.l.kleinschmidt@gmail.com>

Show all headers | View raw


On Thursday, October 3, 2013 12:21:27 PM UTC-7, glen herrmannsfeldt wrote:
> christian.bau@cbau.wanadoo.co.uk wrote:
> 
> 
> 
> > The Pascal "WITH" statement is one of those things that seemed 
> 
> > a good idea at the time, but produces highly unreadable code. 
> 
> > The problem is that any identifier within the "WITH" statement 
> 
> > could now have a different meaning. So if you use a local 
> 
> > variable or global variable within the WITH statement, and 
> 
> > then rename or add or remove a member of the struct, your 
> 
> > code might continue to compile with totally changed meaning.
> 
> 
> 
> I wonder how it compares to partial qualification in PL/I.
> 
> PL/I allows (as far as I know, inherited from COBOL) structure
> 
> members to be references with partial qualification if it isn't
> 
> ambiguous.
> 
> 
> 
> If you have A.B.C, and there are no other C's in the program,
> 
> then C is enough. 

What a terrible idea!
Suppose I have a struct AA containing members a through z, each of which is itself a different kind of struct of, and those structs contained members aa through zz, etc., all of these being defined in different files.

Then my code says
  int i = www;

It would be a nightmare trying to find the struct that this instance of www belongs to, especially if some of those modules contained local variables named www.


<snip>

Back to comp.lang.c | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Looking for C's equivalent of Pascal's "with" Ruud Baltissen <rbaltissen@gmail.com> - 2013-10-02 06:35 -0700
  Re: Looking for C's equivalent of Pascal's "with" Eric Sosman <esosman@comcast-dot-net.invalid> - 2013-10-02 10:06 -0400
    Re: Looking for C's equivalent of Pascal's "with" Jorgen Grahn <grahn+nntp@snipabacken.se> - 2013-10-03 13:40 +0000
    Re: Looking for C's equivalent of Pascal's "with" ralph <nt_consulting@yahoo.com> - 2013-10-03 12:42 -0500
  Re: Looking for C's equivalent of Pascal's "with" "BartC" <bc@freeuk.com> - 2013-10-02 15:39 +0100
    Re: Looking for C's equivalent of Pascal's "with" Ben Bacarisse <ben.usenet@bsb.me.uk> - 2013-10-02 16:40 +0100
      Re: Looking for C's equivalent of Pascal's "with" "BartC" <bc@freeuk.com> - 2013-10-02 17:20 +0100
  Re: Looking for C's equivalent of Pascal's "with" Nobody <nobody@nowhere.com> - 2013-10-02 15:40 +0100
  Re: Looking for C's equivalent of Pascal's "with" christian.bau@cbau.wanadoo.co.uk - 2013-10-03 11:03 -0700
    Re: Looking for C's equivalent of Pascal's "with" Ian Collins <ian-news@hotmail.com> - 2013-10-04 08:12 +1300
    Re: Looking for C's equivalent of Pascal's "with" glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2013-10-03 19:21 +0000
      Re: Looking for C's equivalent of Pascal's "with" Fred K <fred.l.kleinschmidt@gmail.com> - 2013-10-04 11:48 -0700
        Re: Looking for C's equivalent of Pascal's "with" ralph <nt_consulting@yahoo.com> - 2013-10-04 20:01 -0500
          Re: Looking for C's equivalent of Pascal's "with" Keith Thompson <kst-u@mib.org> - 2013-10-04 18:43 -0700
            Re: Looking for C's equivalent of Pascal's "with" Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2013-10-04 21:53 -0400
  Re: Looking for C's equivalent of Pascal's "with" "Sc0rpi0" <sc[zero]rpi[zero]@scosys[dot]eu.org> - 2013-10-11 15:47 +0200
    Re: Looking for C's equivalent of Pascal's "with" Ben Bacarisse <ben.usenet@bsb.me.uk> - 2013-10-11 15:08 +0100

csiph-web