tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: bin/39002: harmful AWK extension: non-portable escaped character



 >>  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
>  about it.
>  
>  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.


> I think we should warn.

Also see standards/38127 and my another mail in this mailing list.
The problem there is close to this one.

-- 
Best regards, Aleksey Cheusov.


Home | Main Index | Thread Index | Old Index