Peter Olson <peabo@???> writes:
>> On January 25, 2016 at 5:54 PM Rainer Weikusat
>> <rainerweikusat@???> wrote:
>
> [...]
>
>> A related but IMHO more interesting set of questions could be:
>>
>> 1. Should every trivial crap $someone ever implemented since 1978 end up
>> in general purpose library just because $someone happend to have to
>> power to put it into it?
>>
>> 2. Should people be required to memoize every trivial crap $someone ever
>> implemented since 1978 just because that someone happened to have to
>> power to ...?
>>
>> 3. Should people who consider themselves Very Superior Entities because
>> the have memoized every trivial crap $someone ever ... and so on, be
>> taken as seriously as they continuously demand?
>
> It must be trivial crap because nobody ever made a programming error parsing
> path names when they rolled their own routines for it.
It's trivial because its about 3 or 4 lines of code, at least for a
reasonable implementation. That's a property of the code and not one of
hypothetical people who could be writing code. Eg, in order to write
code, one has to learn to write first and this is anything but trivial
as it needs years of practice.
> Also: Windows and Mac path names follow different rules.
The (fairly recently introduced) BSD basename library function (whose
semantics are quite different from the semantics of the one I posted)
doesn't deal with anything but UNIX(*) pathnames.
Programs I write as part of my slowly growing set of "tools usable for
starting/ manageing processes" certainly don't have to deal with
"Windows and Mac path names", either.
> Use the libraries.
"Use libraries insofar you consider them useful." And a library
implementation of 'basename' is not something I'd consider useful,
especially when using it portably would require more code than not using
it (the string would need to be copied, including handling errors in
that, and the result would need to be copied, including handling errors
in that, and all the weird special cases someone considered sensible
would need to be dealt with one by one in order to achieve what I wanted
to achieve and even then, there'd be differences).
YMMV.