bug-gnulib
[Top][All Lists]
Advanced

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

Re: [bug-gnulib] Non-standard types in public header files (was: Re: ssi


From: Bruno Haible
Subject: Re: [bug-gnulib] Non-standard types in public header files (was: Re: ssize_t)
Date: Fri, 12 Aug 2005 18:21:50 +0200
User-agent: KMail/1.5

Simon Josefsson wrote:
> I realized I couldn't use the ssize_t module directly in GnuTLS.
> GnuTLS uses ssize_t in its public header file

Ouch. This is as bad as using 'bool' in public header files.

> The problem, of course, is that the installed header file cannot
> assume a config.h and the HAVE_* stuff.  It should simply work.
>
> A naive implementation of this idea would only work with the same
> compiler as the one used when building the package.

This can be worked around with suitable #ifs.

The bigger problem is that your library is not the only one in the world,
and if you define ssize_t as 'long' and another library defines it as
'int', the user of your library has BIG interoperability problems.

For this reason, I recommend: just don't do it. In public headers:
- Instead of 'bool', use 'int' or 'gnutls_bool_t'.
- Instead of 'ssize_t', use 'long' or 'gnutls_ssize_t'.

Bruno





reply via email to

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