Re: Some comments about GVFS



On Fri, 2007-05-04 at 15:27 +0200, Mathieu Lacage wrote:

> > > 5) You seem to use void * in as the data pointers. All applications I
> > > know use guchar * (some use gchar *) to handle data. From my stream
> > > handling experience this is to encourage people to think about what
> > > they pass to such a function. This seems to encourage calling
> > > functions like this: write (mywidget, sizeof (MyWidget)) - with is a
> > > bad idea for multiple reasons, including but not limited to struct
> > > padding. MS formats seem to have done that a lot.
> > 
> > I'm not partial to any format here. Do people thing that using a char
> > type rather than a void type is better? 
> 
> I tend to use uint8_t * because I rely on stdint.h: this makes it
> totally unambiguous that you are dealing with bytes, IMHO. I like to
> avoid char * whenever I can because I have gotten more than once into
> portability problems due to the fact that the signedness of char is
> different on different platforms. If I remember correctly one of the
> embedded platforms I used to work on (ARM or MIPS, I cannot recall at
> the moment) was unsigned char while x86 is usually signed char.

for unformatted blobs of data, the convention in GLib/GTK+ appears to be
using guchar*, to avoid the signedness issue like you reported; see the
GtkSelectionData and the drag and drop API in GTK+ and the base64 API in
GLib for precedents of that.

ciao,
 Emmanuele.

-- 
Emmanuele Bassi,  E: ebassi gmail com
W: http://www.emmanuelebassi.net
B: http://log.emmanuelebassi.net




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