Re: [xml] [PATCH] libxml2-2.6.1 for BeOS



On Sat, 2003-11-01 at 15:37, shard neoni net wrote:

int setsockopt(int sd, int prot, int opt, const void *data, unsigned 
datasize); 

so, in theory, it's ok to use any type of data as long as datasize is set 
properly, but if it's more "clean" to use int, or long it's ok.

You may very well be right, but I do not feel comfortable about the
bool solution for two reasons:

1. Using a data type without confirming that it is the correct
   type is a classic portability pitfall. According to your line
   of reasoning it should be ok to use a double, but does the
   setsockopt() implementation handle this correctly (I would
   guess not, as it has no indication about the encoding of the
   data passed, only its size.)

2. The bool type is not a standard C data type.

Normally the actual data type is described under the description
of the option (SO_NONBLOCK). For example, if you look at the SUSv3
standard [1] (the successor of POSIX) it explicitly mentions what
data type the arguments must be. However, SUSv3 does not include the
SO_NONBLOCK option (as this is handled by fcntl(O_NONBLOCK)).
Unfortunatley, I am not able to find any on-line BeOS documentation,
so I cannot check what BeOS expects.

[1]
http://www.opengroup.org/onlinepubs/007904975/functions/setsockopt.html




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]