andreyvul <andrey....@gmail.com> wrote:
> Peter Nilsson <ai...@acay.com.au> wrote:
> > andreyvul <andrey....@gmail.com> wrote:
> > > ...Any workarounds or tips on how to make a structure
> > > such that it behaves like an enum but its members can
> > > be addressed with '.'?
> >
> > No.
> >
> > > I don't want to have to do this using #defines, as it
> > > would be far too messy.
> > > code:
> > > static struct {
> > > * * static const int baz = 1;
> >
> > This is not legal C.
> >
> > > } bar;
> > >
> > > void foo() {
> > > * * int x = bar.baz;
> > > }
> >
> > C++ probably has the feature you're looking for.
>
> I know.
>
> > Judicious naming conventions is as close as you'll come
> > in C.
>
> 
>
> So I'm stuck to #defines, then?
Unlike your #define (which I'm not sure how you see it
operating), naming conventions is established practice,
so it's easier to maintain.
Perhaps if you explain the real problem, in partiuclar why
you need a static member of a struct, then we can suggest
better alternatives.
--
Peter