Hi,

On Wed, Jul 12, 2000 at 12:30:21AM -0400, Steve Robbins wrote:
> Argument 5 is --- as far as I can tell --- always 'struct timeval *' or
> 'const struct timeval *'.  For code that uses select(), you needn't care
> whether it is prototyped with 'const' or not, right?  So nothing needs to
> be defined for type type of argument 5.

Not so.  If your wrapping the select() function with a C++ wrapper, for
example, then you do need to know if the fifth argument is a const or
not so that the argument passed to the wrapper has the same "const-ness"
of the select() fifth argument.  Here's an example:

  int
  My_Wrapper::select (int width,
                      fd_set *read_fds,
                      fd_set_*write_fds,
                      fd_set_*excep_fds,
                      const struct timeval *tv)
  {
   // Assume ::select() expects a 'struct timeval *' argument.
   // Compile-time error will occur.
   return ::select (width, read_fds, write_fds, excep_fds, tv);
  }

If the select() call expects a non-const timeval argument, then the above
code will fail to compile on a C++ compiler.  One could argue that
this could be fixed by removing the const from the fifth argument of the
wrapper, but this isn't always an option since users may want semantics
to match those of a const argument, i.e. they don't want their timeval to
be modified.  As such, I don't think the const-ness of the fifth argument
can be ignored in the macro you're referring to.

-Ossama
-- 
Ossama Othman <[EMAIL PROTECTED]>
Distributed Object Computing Laboratory, Univ. of California at Irvine
1024D/F7A394A8 - 84ED AA0B 1203 99E4 1068  70E6 5EB7 5E71 F7A3 94A8

Reply via email to