Skip to content

change options argument type to unsigned int - #353

Open
stevengj wants to merge 2 commits into
masterfrom
options_typefix
Open

change options argument type to unsigned int#353
stevengj wants to merge 2 commits into
masterfrom
options_typefix

Conversation

@stevengj

@stevengj stevengj commented Sep 10, 2026

Copy link
Copy Markdown
Member

This PR changes argument-type declarations of the form utf8proc_option_t options to unsigned int options. The former is technically incorrect (though it worked in practice) because this argument is not in general an enumerated value, but is rather a bitwise-OR of enumerated values.

(This change doesn't break the ABI, because the byte representation of enum is the same as that of unsigned int on all widely available systems, I think, even though strictly speaking this is not required by the C standard?)

I noticed this because gcc was emitting warnings like:

test/custom.c:20:99: warning: implicit conversion from
      'int' to enumeration type 'utf8proc_option_t' is invalid in C++
      [-Wimplicit-int-enum-cast]
   20 |     utf8proc_map_custom(input, 0, &output, UTF8PROC_CASEFOLD | UTF8PROC_COMPOSE | UTF8PROC_COMPAT | UTF8PROC_NULLTERM,

Originally, these option constants were #define preprocessor constants, but they were changed to an enum by #29.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant