bug-gnulib
[Top][All Lists]
Advanced

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

Re: [bug-gnulib] warnings with gl_anylinked_list


From: Bruno Haible
Subject: Re: [bug-gnulib] warnings with gl_anylinked_list
Date: Tue, 10 Oct 2006 15:18:39 +0200
User-agent: KMail/1.9.1

Ralf Wildenhues wrote:
> you should not used `index' at
> all: eventually, you'll be including strings.h and getting warnings due
> to this (seen on GNU/Linux):
> 
> | NAME
> |        index, rindex - locate character in string
> | 
> | SYNOPSIS
> |        #include <strings.h>
> | 
> |        char *index(const char *s, int c);
> [...]
> | CONFORMING TO
> |        4.3BSD

No, there is no reason nowadays (for several years already) to
#include <strings.h>.
  - All systems have a <string.h> that define memset, memcpy etc. -
    more portable than bzero, bcopy, etc.
  - Likewise for index() and rindex(), which have a more portable alternative
    called strchr() and strrchr().
  - The strcasecmp() and strncasecmp() functions declared there don't work
    in multibyte locales.
  - The ffs() function has a more portable (and sometimes faster)
    implementation that converts to a 'double' and extracts the
    exponent from its binary representation.

And so we are free to use 'index' as a variable name.

Bruno




reply via email to

[Prev in Thread] Current Thread [Next in Thread]