Re: portability question



On Thu, 2003-12-18 at 09:47, Magnus Bergman wrote:

> Would it possibly be a good idea if glib could guarantee these sort of
> things? That gint is always the processors word-length and glong is at
> least the size of (the biggest) pointer on the platform. It would of
> course mean that glong could be different from long, but if I want a
> long I could just use an long, right? Am I possibly missing the big
> picture here? Would this cause more trouble than it would solve?

Yes, it would cause more problems then it would solve. We've always
guaranteed that gint/glong are *exactly* the same as int/long and
code assumes that all over the place. If we broke that, then large
amounts of existing code would no longer work.

 E.g:

 long items_read, items_written;
 new_string = g_utf8_to_utf16 (str, -1, &items_read, &items_written,
NULL);

Is a valid (some would say preferred) way to call g_utf8_to_utf16().

> Or perhaps new data types (in glib) would make sense since intprt_t
> isn't available everywhere (I was told)?
> 
> I think these kind of things are important since I find the portability
> of glib being its main feature.

I think the number of cases where you need intptr_t instead of 
size_t/ssize_t are very small. And we do have gsize/gssize aliases
for size_t/ssize_t.

Regards,
						Owen





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