- Structures
-
On a related note, in C, structs are very under-utilized. Most C compilers
carry no overhead for referring to a member of a structure structs are just
as efficient to access as simple variables. But structs provide two
important benefits over simple variables:
1. They provide an indication of grouping and association.
2. They automatically provide a sort of constricting syllables way of
naming things. In fact, member names can actually be simpler to invent,
because they can depend on the parent for some of the description.
For instance, consider motor.velocity.change and motor.velocity.old. The
final member name is not particularly descriptive, but the name as a whole
works very well because of the structure of parents. It is obvious that
these are related things, because they are part of the same structure
Thursday, January 19, 2006
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment