Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| Newsgroups | comp.lang.c |
|---|---|
| Date | 2013-10-02 06:35 -0700 |
| Message-ID | <12de4151-32fd-4cb9-bb8a-affd0079db8d@googlegroups.com> (permalink) |
| Subject | Looking for C's equivalent of Pascal's "with" |
| From | Ruud Baltissen <rbaltissen@gmail.com> |
Hello,
The Pascal equivalent of struct is record. It is possible to nest records inside other records, just like with structs. Assume record Drive0 is nested inside record Device and has the elements InUse and PCfile:
Device = record
...
...
Drive0 = record
InUse : boolean;
PCfile : string;
...
end;
...
end;
If I want to access PCfile of Drive0 I could do it like this:
Device.Drive0.PCfile := "D:\disk.ima";
In C it would look about the same. But in Pascal there another way:
with Device do
begin
...
...
with Drive0 do
begin
InUse := True;
PCfile := "D:\disk.ima";
end;
end;
This comes in handy when handling a lot of elements in one go, for example: when initializing a drive.
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?
Thank you for your time and info!
Kind regards, Ruud Baltissen
www.Baltissen.org
Back to comp.lang.c | Previous | Next — Next in thread | Find similar
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