[CCing sc22wg14] Hi Alejandro,
> There are other equality functions I've proposed for C2y: > > n3612, alx-0019r4 - add strpfx(), stppfx(), wcspfx(), and wcppfx() > <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3612.txt> > > n3613, alx-0020r3 - add strsfx(), stpsfx(), wcssfx(), wcpsfx() > <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3613.txt> The function names in these proposals are an abomination. Like Collin Funk (as a representative of the younger generation) said [1]: He prefers longer names. When strcmp et al. were first created, assemblers and linkers limited symbols to max. 6 characters. (This limitation was adopted in Fortran 77 as well.) Also, typing on punched cards was a pain; therefore it was useful to have short identifiers. But that was 50 years ago! Nowadays, identifiers have become longer in all programming languages. It has become clear that maintainable code is being _read_ by developers many more often than it is _written_. And for writing, IDEs nowadays have identifier completion. So, everyone should be using readable identifiers. And "readable" also implies "pronounceable" [2]. While "strcmp" is typically pronounced "string-compare", 'stppfx' is simply not pronounceable. (I say this despite being accustomed to German language, which has words with up to 7 consonants in a row [3].) When words like "break" were shortened to 'brk', and "span" to 'spn', by eliminating vowels, that was due to the limitation of 6 characters. Nowadays such shortening is not only not needed, it is counter-productive for maintainability. And when you shorten "prefix" to 'pfx' and "suffix" to 'sfx', you are not only eliminating vowels, you also removed one of the consonants. ISO C already has standardized longer identifiers: fegetexceptflag fe_dec_getround fmaximum_mag_num decodebind128 atomic_compare_exchange atomic_flag_test_and_set atomic_flag_test_and_set_explicit stdc_first_leading_zero_ull memset_explicit the longest of these being 33 characters long. > I know you already have str_startswith() and str_endswith(). Yes, and these names in Gnulib have the descriptiveness and pronounceability that I think *all* new identifiers in ISO C should have. > the reason we chose those names in the > committee --originally, the proposal was for stpprefix() and > strsuffix()-- is that those compacted names are usually avoided by users > as they know libc is more likely to take those. Thus, there's less > existing code that would conflict with those names. I don't think this is a strong enough argument for forcing unreadable and unpronounceable names down to all C programmers. Regards, Bruno [1] https://lists.gnu.org/archive/html/bug-gnulib/2025-09/msg00212.html [2] because that happens in the developer's brain [3] Auskunftspflicht
