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

Bug#1059873: 12.14.5 String Input Conversions: The meaning of ‘%[\0abut]’ conversion is unclear



Hi,

On 2024-01-04 17:59, Krzysztof Żelechowski wrote:
>    The fact that the NUL character ends a string data structure is a library
>    convention rather than a language feature, except for the "" literal
>    syntactic sugar. 

We are here talking about *string* functions of the C standard. String
functions in this context are defined as NULL terminated. The beginning
of section 12.14 makes clear that the argument of the fscanf function is
a format *string*.

> But it is not a programming error to have a string
>    literal with embedded NULs; in fact, if your narrowing interpretation were
>    universally correct, the argz API would not be possible.  You can write

The argz functions do not operate on strings. They operate on *vector of
strings*. See section 5.15.

>    valid programs in C without using this convention, e.g. using BSTR
>    everywhere.  You were even supposed to do that when programming in C for
>    Apple Macintosh, to the extent that their C compiler used to provide an
>    alternative string literal syntax for this purpose as an extension.

Indeed you are allow to use your own convention for a library, but But a
string is well defined in the C standard in the context of the string
functions.

Regards
Aurelien

-- 
Aurelien Jarno                          GPG: 4096R/1DDD8C9B
aurelien@aurel32.net                     http://aurel32.net


Reply to: