e: GNOME CVS: gnome-common kmaraas



Lars Wirzenius wrote:
> 
> [ Please don't Cc: public replies to me. ]
> 
> > > >   -       inp_text = strndup (inp_text, inp_text_limit);
> > > >   +      (char *)inp_text = strndup (inp_text, inp_text_limit);
> 
> Lvalue casts are not allowed by the C language. Some compilers
> extend the language by allowing them, but use of this feature
> is a terribly bad idea.
> 
> > I get a warning waying 'assignment makes pointer from integer without
> > a cast'.
> 
> This almost certainly means that as far as the compiler knows, strndup
> returns an int, not a pointer. That is, a declaration for strndup
> is missing.
> 
> Lars, formerly a language lawer wannabe on comp.lang.c :)
> 
>   ------------------------------------------------------------------------
> 
>    Part 1.2   Type: application/pgp-signature

After reading the code some more I found that if I comment out '#definr
HAVE_STRNDUP 1'
in config.h, the error message dissapears, because strndup is declared
in gnome-argp.h. Is there a possibility that something is wrong with my
system here or what? Shouldn't it be enough to #include <string.h> to
get the declaration for strndup()?

Cheers
Kjartan



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