C (24/257)

From:
Date:02 Feb 2001 at 13:46:26
Subject:Re: structures...

On Thu, 1 Feb 2001, Alexander Niven-Jenkins wrote:

> In Delphi there is a keyword 'with' which allows you to do the following;
>
> struct test blah;
>
> with blah do
> begin
> str = abc;
> val = xyz;
> end;
>
> Is there an equivalent in C/C++?

you could probably set up some macro definitions to get a similar
effect, e.g.

#define V(x) shortcut.x

// later...

struct test blah

#define shortcut blah

but whether it's worth it depends on how nested your structure is, how
good your preprocessor is and how badly you miss Delphi.

Thom

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