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


Groups > comp.lang.c > #36945

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

From Nobody <nobody@nowhere.com>
Subject Re: Looking for C's equivalent of Pascal's "with"
Date 2013-10-02 15:40 +0100
Message-Id <pan.2013.10.02.14.40.26.774000@nowhere.com>
Newsgroups comp.lang.c
References <12de4151-32fd-4cb9-bb8a-affd0079db8d@googlegroups.com>
Organization Zen Internet

Show all headers | View raw


On Wed, 02 Oct 2013 06:35:33 -0700, Ruud Baltissen wrote:

> I'm looking for a C equivalent of this "with" construction. All
> programming examples I saw so far always showed the complete structure. Is
> there an equivalent or not?

No.

However, given a structure, you can obtain a pointer to any field within
that structure, then access fields via that pointer. So when dealing with
nested structures, it's not uncommon to take a pointer to some
sub-structure and assign it to a variable. You can't make fields appear as
variables, but you can collapse the top-level variable name and any number
of intervening levels into a single variable.

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