RFR: 8301197: Make sure use of printf is correct and actually needed
Magnus Ihse Bursie
ihse at openjdk.org
Fri Apr 4 13:44:02 UTC 2025
On Fri, 4 Apr 2025 07:17:16 GMT, Erik Joelsson <erikj at openjdk.org> wrote:
>> `echo -n` ?
>
> I wasn't aware of that feature in `echo`, but I agree that if we are using printf just to omit the line break, then `echo -n` seems like a better choice.
I'm not sure I agree. Why would:
$$(ECHO) -n '$$($1_OVERVIEW_TEXT)'
be better than
$$(PRINTF) "%s" '$$($1_OVERVIEW_TEXT)'
?
We're kind of squabbling over details here, and it really doesn't matter as much, but I don't think there is really anything to gain by going down that route. If nothing else, `echo -n` seems like less widespread knowledge (Erik didn't know, I knew but had forgot since I never use it). In contrast, I believe the printf syntax is a bit more well known.
But sure, I can use `echo -n` instead of `printf` where possible. Just give me one good reason why.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/24415#discussion_r2028838781
More information about the build-dev
mailing list