On Thu, 8 Mar 2018, Sven Schreiber wrote:
Am 08.03.2018 um 10:23 schrieb oleg_komashko(a)ukr.net:
> It seems, there is nothing special
> about strstr:
...
> It looks like 'if' can evaluate non-empty string
> alone as 1 but can't evaluate logical expressions
> with string input
OK, thanks for pointing that out. I tend to think --apart from
backward-compatibility reasons-- that either stuff like 'if "a"' should
be
banned, or the full logical implications should work as well.
Yep, either we ensure that the result of "if s", for s a string
(literal, variable or expression), is consistently equivalent to "if
strlen(s) != 0", or else we ban this usage as too obscure.
I think my preference would be for the latter, unless there's a
significant compatibility issue.
Allin