This is the mail archive of the gcc-help@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]
Other format: [Raw text]

Re: gcc


Matthieu Moy wrote:
If the program ends properly, I think the output *has* to be flushed,

Yes. If main() returns or exit() is called, all open streams are closed; if an open stream is closed, it is flushed.

That's why its generally a good advice to put "\n" at the end of any
debug/test output.

Note that (on typical Unix-like systems) only stderr is line buffered by default; stdout is block buffered. This means that a '\n' char is not enough to flush stdout; either explicitly call fflush() or use setbuf() or setvbuf().


Segher




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