[pcre-dev] [Bug 1918] #define ⇒ enum?

Startseite
Nachricht löschen
Autor: admin
Datum:  
To: pcre-dev
Betreff: [pcre-dev] [Bug 1918] #define ⇒ enum?
https://bugs.exim.org/show_bug.cgi?id=1918

Philip Hazel <ph10@???> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |WONTFIX
             Status|NEW                         |RESOLVED


--- Comment #6 from Philip Hazel <ph10@???> ---
(In reply to Giuseppe D'Angelo from comment #4)
>
> The right way to do this is using enums:
>
>     enum pcre2_config_what { pcre2_config_this, pcre2_config_that };
>     int pcre2_config(enum pcre2_config_what, void *where);
>     /* now I must pass exactly one of the enumerators or the code doesn't
> compile */


Thank you for the full explanation. The problem is that I am too old. I came to
C from BCPL, and always considered enums to be like BCPL's "manifest" (which is
really like #define) instead of being a special kind of type. Old habits die
hard!

> Of course it's too late to do this now. This is an API and ABI break. Maybe
> for PCRE3? :P


It is indeed too late - and it's been like this in PCRE1 since it was first
released in 1997 without anybody pointing out this issue. No wonder I just
copied it over to PCRE2. Without changing pcre2_config() etc. there is no point
in changing the #defines to an enum. I am going to close this issue "wontfix",
but I have noted the issue on the long-term wish-list so that it won't be
entirely forgotten if there ever is another API/ABI break.

--
You are receiving this mail because:
You are on the CC list for the bug.