Paul Eggert wrote:
> > The casts are there for platforms where mmap()
> > returns a 'caddr_t', i.e. 'char *', not 'void *'.
> 
> Even on those old platforms, it's not necessary to supply a cast in a 
> declaration like 'void *p = mmap (...);'

Assigning a 'char *' from a 'void *' still generates a diagnostic.
Therefore omitting the cast introduces new warnings on such platforms.

> and to modern eyes it looks 
> odd to see a cast there (why cast something to the same type?)

Yes, it's odd if one has only POSIX in mind. But Gnulib being (to a
significant extent) a library which deals with portability pitfalls,
the obvious answer to the question "why is there a cast here?" is
"it's because things are different on some platforms".

> and that 
> makes the code slightly more confusing. That's why I'd rather remove the 
> useless cast and remove the pragma that suppresses the warning about the 
> cast.

No, better not. I reply to that idea in another mail.

> I suppose we could wrap mmap on Solaris 10 so that mmap 
> returns void *, but given that the workaround is so simple it's probably 
> not worth the trouble for such a niche platform nowadays.

Right. I agree with that. We don't override functions because of "small"
type differences.

Bruno




Reply via email to