[gnutls-devel] Moving defines (3.4) to enum (3.5.) in header files needs discussion...

Tim Ruehsen tim.ruehsen at gmx.de
Wed Jul 20 12:30:29 CEST 2016


Hi Nikos,

I just realized that you turned several defines into enums with GnuTLS 3.5.x.

This simply breaks existing code (e.g. wget2) and took me a while to find out.

Example:
#ifdef GNUTLS_NONBLOCK
		gnutls_init(&session, GNUTLS_CLIENT | GNUTLS_NONBLOCK);
#else
	// very old gnutls version, likely to not work.
	gnutls_init(&session, GNUTLS_CLIENT);
#endif

Of course you might say, I should test this in ./configure ... but basically 
lot's of code uses this kind of checks (e.g. the new TCP fastopen code has 
things like #ifdef MSG_FASTOPEN etc.). I just pray that glibc maintainers 
don't do the same one day...

Personally, I don't see the point in using enums for flags in C. AFAIK, gcc 
doesn't check types for enums at all. Using any value for an enum variable or 
function parameter is allowed (no warning). Do I miss something here ?

Regards, Tim
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part.
URL: </pipermail/attachments/20160720/b47cd89c/attachment.sig>


More information about the Gnutls-devel mailing list