top | item 2601997

(no title)

smh | 14 years ago

This sort of thing will likely cause more problems than it solves. Such a struct can't be moved, copied, or put in an array without potential memory corruption.

I'd suggest doing this:

  typedef struct {
    int a;
    int b;
    /* private */
    int c;
    int d;
  } STYPE;
Sure, other programmers are free to ignore the comment and use the private fields anyway, but that suggests a bigger problem that can't be fixed with a clever pre-processor hack.

discuss

order

No comments yet.