bug-bash
[Top][All Lists]
Advanced

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

Re: "printf %d ''" should diagnose the empty string


From: Paul Eggert
Subject: Re: "printf %d ''" should diagnose the empty string
Date: Wed, 20 Nov 2024 08:33:22 -0800
User-agent: Mozilla Thunderbird

On 2024-11-20 07:31, Martin D Kealey wrote:
 From a semantic perspective, because "" doesn't contain any non-digits.

Under that argument, "printf %d -" shouldn't report an error either, because "-" doesn't contain anything other than what could appear in an integer.

Anyway, this isn't an issue of personal preference, as POSIX says printf must diagnose anything that isn't a valid C integer constant, and the empty string is clearly not such a constant. If Bash is in POSIX mode it must issue a diagnostic, and there's little reason for Bash's non-POSIX mode to differ.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]