Because these things were written many decades ago, it's generally only be a question of interest for historians :-)
It was probably just a design decision (or lack of decision) that caused them to be this way and, since ISO value backward compatibility, they've never changed it.
It may be that puts
was written first and, when it came time to write fputs
, the developer simply cut'n'pasted it, tacking the new parameter onto the end. Even if the same situation existed for printf/fprintf
, that wouldn't have been possible due to the need for the variable argument list to be at the end.
But, supposition aside, now that our beloved Dennis is gone, we may never know the actual reasons..
printf
did it out of necessity (as you already noted) andfputs
was probably already established by then, so reversing it to match was seen as untenable. – Duskstdio
is a poorly designed library in general: there are plenty of other issues with it. – Chaliapinfwrite()
means that if there is a partial write it can't tell you how many bytes got written, only how many elements, so you can never know about a partial element write. It would have been better omitted. Putting theFILE *
parameters at the end instead of the beginning is another example. There were better-designed APIs around at the time. – Chaliapin