Hello Robert,

ever is best. Not sure that "pfds" is the right name. If the two variables
means the same thing, they should have the same name, although possibly
different types.

Although I agree with a good bit of what you say here, I don't agree
with that.  If the member used by ppoll() (or just poll()) has a
different name than the one used for select(), it's much easier to,
say, grep for everyplace where the field you care about is used.  If
you use the same name for different things, that doesn't work.

I'm not sure it is incompatible.

My point is consistent with my other advice which is to hide the stuff in functions with identical (or compatible) signatures, so that the only place where it would differ would be in the functions, where greping would work.

 #ifdef USE_POLL
  // pool specific stuff
  #define SOME_TYPE v1_type (or typedef)
  void do_stuff(v1_type * stuff) { ... }
  ...
 #else /* default to SELECT */
  // select specific stuff
  #define SOME_TYPE v2_type (idem)
  void do_stuff(v2_type * stuff) { ... }
  ...
 #endif

Then later the code is not specific to poll or select, eg:

 SOME_TYPE mask;
 do_stuff(mask);
 do_other_stuff(...);
 if (is_ready(mask, ...)) { ... }

--
Fabien.

Reply via email to