How to handle nested structs when converting C headers?
bearophile
bearophileHUGS at lycos.com
Thu Dec 12 03:07:30 PST 2013
Regan Heath:
> I would stop nesting the struct definition. I think that is
> both cleaner and closer to the original intent - the only
> reason it is nested in C is because C allows definition and
> declaration that way, and D does not. Then you don't need
> static at all.
It's mostly a matter of style, but here I prefer a little more
the nested form. It's syntactically closer to the original C
file, for a D programmer "static struct" has a known and clear
meaning, and putting the structs inside the other keeps the
global namespace clean of those inner names. Like with nested
functions putting names inside other scoped helps the programmer
see they are just needed there.
Bye,
bearophile
More information about the Digitalmars-d-learn
mailing list