Re: problem with glib 1.3.7 on darwin



on 9/10/01 12:03 PM, Max Horn at max quendi de wrote:

> [I am not sure if this is the right list for this, I couldn't find
> one better suited, but please point me to a better place than this if
> there is one! thanks]

This is the right list.

> In line 329ff it complains about isalnum, isalpha etc. missing. The
> code look like this:
> 
>  #define TEST_IS(name) test_is_function (#name, test_##name, name,
> g_unichar_##name)
>  isalnum('a');
>  TEST_IS (isalnum);
>  TEST_IS (isalpha);
>  ...
> 
> The reason is simple: darwin's ctype.h #define's those as macros:
> #define isalnum(c)      __istype((c), (_A|_D))
> ...
> 
> But the C preprocessor will not expand isalnum ! It would be wrong
> for it in fact. GLIB assumes that those functions are real function,
> but in real, on many many implementations they are macros.

The C standard requires that things like isalnum be available as both macros
and functions, so you can take a pointer to the function if you want. I
guess there is a bug in BSD and it doesn't have the functions.

I have changed the test so that it works even on platforms where this is
broken.

    -- Darin





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