Paul Eggert wrote:
> Not sure I like having bool variants that are trivial wrappers for the
> pointer variants, though. Life is already complicated enough.
Unlike Paul, I don't mind having two different functions
- str_startswith, that returns 'bool',
- str_prefix_end, that returns 'char [const] *'.
They have different purposes, That justifies the different names.
Having only the function that returns the pointer and telling the
programmers to use this function when in fact they want a 'bool'
* either leads to code like
if (str_prefix_end (str, p) != NULL)
which is longer and less expressive than
if (str_startswith (str, p))
* or introduces implicit conversions from pointer to bool
if (str_prefix_end (str, p))
which some people abhor.
Bruno