|
From: | Manuel Collado |
Subject: | Re: lint warning: unnecessary mixing of `>' and `>>' |
Date: | Tue, 24 Oct 2023 15:31:52 +0200 |
User-agent: | Mozilla Thunderbird |
El 24/10/23 a las 11:01, arnold@skeeve.com escribió:
Hi Manuel. You didn't test it properly: $ gawk --lint -i openout 'BEGIN{openout("data.txt", "a"); print "xyz" > "data.txt"}' gawk: cmd. line:2: warning: unnecessary mixing of `>' and `>>' for file `data.txt' gawk: warning: no explicit close of file `data.txt' provided
Hmmm. I see. My test was:$ gawk --lint -i openout 'BEGIN{openout("data.txt", "w"); print "xyz" > "data.txt"}'
gawk: warning: no explicit close of file `data.txt' providedSo this --lint warning is a runtime test, right? I wrongly assumed it was a parsing check.
Thanks. Regards.PS: It is probably good style to use >> in the first file write, and > in all subsequent writes.
-- Manuel Collado - http://mcollado.z15.es
[Prev in Thread] | Current Thread | [Next in Thread] |