[RFC v1 1/1] string: Add streq(), memeq(), wcseq(), wmemeq()

Alejandro Colomar alx@kernel.org
Tue Sep 2 08:25:37 GMT 2025


Hi Joseph,

On Tue, Sep 02, 2025 at 10:09:08AM +0200, Alejandro Colomar wrote:
> On Mon, Sep 01, 2025 at 04:53:14PM +0000, Joseph Myers wrote:
> > On Mon, 1 Sep 2025, Adhemerval Zanella Netto wrote:
> > 
> > > It is for C89 [1]:
> > > 
> > > :::: -std=c89 -D_GNU_SOURCE=1
> > > In file included from ../include/string.h:60,
> > >                  from ../inet/netinet/icmp6.h:22,
> > >                  from ../include/netinet/icmp6.h:1,
> > >                  from /tmp/cih_test_4ZNjF5.c:10:
> > > ../string/string.h:86:14: error: expected ';' before '_Bool'
> > >    86 | static inline _Bool
> > >       |              ^~~~~~
> > 
> > That's about inline not being a keyword (should be using __inline).  
> 
> Ahhh, thanks!
> 
> > Although if anyone tries to use GCC versions before GCC 3.0 with the 
> > headers, they'd run into lack of _Bool as well.
> 
> Does glibc support such old GCC versions?
> 
> If so, should I hide the declarations with some #ifdef for the GCC
> version?  Or should we just say GCC <3.0 is not supported with the
> headers?

BTW, can we have a __bool type that does the right thing for both C and
C++?  Where should I define it?

I'm thinking of something like

	#ifdef __cplusplus
	typedef bool  __bool;
	#else
	typedef _Bool __bool;
	#endif

I think I should put that in cdefs.h, and then use it everywhere I need
a boolean.


Cheers,
Alex

-- 
<https://www.alejandro-colomar.es>
Use port 80 (that is, <...:80/>).
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/libc-alpha/attachments/20250902/39a77dbd/attachment.sig>


More information about the Libc-alpha mailing list