This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: patch to suggest putc/fputs over printf("string") or printf("\n")


>     I suppose we need to know the stdout expansion for changing
> printf() -> fputs(, stdout) and also for fprintf(stdout, "%s\n",) -> put$

Seems to mee you guys are too smart and are working too hard.

The only reason you need stdout is because there are some functions
that don't take stdout, that have to be turned to a function that does.
The way around that is to introduce new functions that implicitly take
stdout.

e.g.

	printf("Hello world\n") -> __fputs_stdout("Hello world\n");

Now, your header file might previously have said

inline int __fputs_stdout(const char* s) { return fputs(s, stdout);}

so you wind up with the same thing.  So the only thing that makes stdout
special is its use in these functions, but your translation is portable.



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]