Some of the functions in stdio seem to have the stream as the last argument, for example:
char *fgets(char *restrict, int, FILE *restrict);
int fputs(const char *restrict, FILE *restrict);
size_t fread(void *restrict, size_t, size_t, FILE *restrict);
size_t fwrite(const void *restrict, size_t, size_t, FILE *restrict);
while some have it as the first argument:
int fgetpos(FILE *restrict, fpos_t *restrict);
int fseek(FILE *, long, int);
Why is this inconsistency? Were these functions added at different time in the evolvement of the standard library? In that case which were first, and why was the convention changed?
I realize that it's more or less needed for fprintf
with friends to have the FILE*
first (or at least early) due to the ellipsis (and for fclose
and similar to have it first, and last).