C (29/257)

From:
Date:02 Feb 2001 at 16:40:32
Subject:Re: structures...

Hello Alexander

On 01-Feb-01, you wrote:

AN> Say you had the following structure:

AN> struct test
AN> {
AN> char *str;
AN> long val;
AN> }

AN> In Delphi there is a keyword 'with' which allows you to do the
AN> following; rather than...

AN> struct test blah;

AN> blah.str = abc;
AN> blah.val = xyz;

AN> ... you can do...

AN> struct test blah;

AN> with blah do
AN> begin
AN> str = abc;
AN> val = xyz;
AN> end;

AN> Is there an equivalent in C/C++?

You can do:

#define str blah.str
#define val blah.var

str=abc;
val=xyz;

#undef str
#undef val

Thats a workaround.

Regards

------------------------ Yahoo! Groups Sponsor ---------------------~-~>
eGroups is now Yahoo! Groups
Click here for more details
http://click.egroups.com/1/11231/0/_/451227/_/981130230/
---------------------------------------------------------------------_->