Re: [dev] [sbase] printf(1)
Roberto E. Vargas Caballero, Thu, 19 Dec 2013:
>>> I'm confused about what you're trying to accomplish here.
>>> How about you just copy the format part from the for loop up there and
>>> throw it into the standard library's printf?
>>>
>>
>> I agree!
>> This strongly smells like NiH-syndrome. Considering we have suckless
>> standard libraries like uClibc, which we could link statically to by
>> default some day in the future, we can safely assume letting the stdlib
>
> I think you are lossing something important here. When you execute
> printf in a program you have the variables which you want to pass
> to printf, or in the case of vprintf you have the va_list, but
> in this case you don't have any of them. You cannot call to printf
> (or vprintf, or sprintf, or vsprintf) with an array of pointers
> to chars (argv), so you have to forgot the library routines.
Exactly. Not to mention, what if the user did this:
printf '%f\n' 2
If you "throw it into the standard library's printf", even forgetting
about how we do that, you'd still interpret 2 as an int, when printf
expects a float. And that's only the beginning, what about %n, or not
passing enough arguments?
Rob
Received on Thu Dec 19 2013 - 23:18:34 CET
This archive was generated by hypermail 2.3.0
: Thu Dec 19 2013 - 23:24:06 CET