help-libidn
[Top][All Lists]
Advanced

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

Re: LibIDN code quality suggestions


From: Bittner Ede
Subject: Re: LibIDN code quality suggestions
Date: Wed, 19 Oct 2011 14:20:31 +0200
User-agent: Mozilla/5.0 (Windows NT 6.1; rv:7.0.1) Gecko/20110929 Thunderbird/7.0.1

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 2011.10.19. 13:26, Simon Josefsson wrote:
> Right.  But do you really need to turn the enum's into #define's?
> Why? Assigning an enum value to an int is never a problem in C++,
> right?

Yes, you can safely convert any enum values to int, the other way
without casting gives you a compile error. My reasons are the
following why I think you should remove the enum:

1, It's raerly reasonable to mix types in a strongly typed language.
2, If you leave the enum and use the values from the enum, you always
use a silent cast to int.
3, It will allow, to break the interface again, because the enum
remains a valid type.
4, If you use a define, its value type will match with your return type.

Btw you can't delete the enum now, because then it will break all
current code wich use typecast to get over the current situation. So I
won't complain more about that. :)

> 
> Btw, I have asked on the gnulib list for advise on the change: 
> http://thread.gmane.org/gmane.comp.lib.gnulib.bugs/28704
> 
> Unless there are platforms where this modifies the ABI, or some
> other strong reason against, I'll make the change for the
> *_strerror functions.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.14 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk6ewI4ACgkQRg1a/GImAJLRbgCfdUlGuRmwqiJUQsfz0jjtiG1T
N9cAoJcoqfpdLtVR/CSZ02r/Q4g+SF7K
=oH+J
-----END PGP SIGNATURE-----



reply via email to

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