RFR: 8301197: Make sure use of printf is correct and actually needed

Magnus Ihse Bursie ihse at openjdk.org
Fri Apr 4 14:07:53 UTC 2025


On Fri, 4 Apr 2025 13:53:57 GMT, Erik Joelsson <erikj at openjdk.org> wrote:

>> 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.
>
> I just thought that if you tried to standardized on `echo` where possible instead of `printf`, it would make sense. I often feel awkward having to switch to the completely different syntax of printf just to prevent the newline. Having a simple option to echo that just omits the newline seems more straightforward. There are of course still usecases for printf. I don't mind that much either way though, so I'm really fine with either.

Okay, fine. That's a good enough reason. I'll switch.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/24415#discussion_r2028878464


More information about the build-dev mailing list