[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: bin/39002: harmful AWK extension: non-portable escaped character
The following reply was made to PR bin/39002; it has been noted by GNATS.
From: David Holland <dholland-bugs%netbsd.org@localhost>
Cc: gnats-admin%netbsd.org@localhost, netbsd-bugs%netbsd.org@localhost,
Subject: Re: bin/39002: harmful AWK extension: non-portable escaped
Date: Sat, 21 Jun 2008 20:27:15 +0000
On Fri, Jun 20, 2008 at 09:35:01PM +0000, Greg A. Woods; Planix, Inc. wrote:
> Gawk is sometimes a noisy pain in the butt. :-)
> It is long standing tradition in Unix tools and languages to ignore
> the backslash on non-special characters, right from C on up.
Ordinarily, I'd agree, but in this case I think it's right to warn
In awk one often stuffs regexps into string constants, and it's easy
to forget that if you're trying to escape something *in the regexp*
you need to write two backslashes. Then one ends up with expressions
like (foo ~ "\.c$") that superficially look ok but silently do the
wrong thing. This is doubtless why mawk behaves the way it's reported
to, but I don't think adopting that behavior is a good idea.
David A. Holland
Main Index |
Thread Index |