On Wed, 18 Dec 2019, Sven Schreiber wrote:
Hi,
here is an extremely unimportant observation, not sure if it is even
supposed to be used in hansl. The same input gives different output in
printf and sprintf:
<hansl>
eval printf("%5s", "a") # gives a5
eval sprintf("%5s", "a") # gives a
</hansl>
The function form of printf() is not recommended, or even
documented, but it is doing what it's supposed to (internally). The
format-plus-arg leads to printing "a" (with four leading spaces but
no trailing newline or space), then "eval" prints the return value
from printf(), namely the number of bytes printed -- thus "a5", with
the 'a' and the '5' contributed by different levels of code and just
happening to be contiguous in the output.
sprintf(), on the other hand, returns the constructed string itself,
not the number of byes printed, so "eval" just gives four spaces
followed by 'a'.
Allin