|
|
|
|
|
by premchai21
5553 days ago
|
|
I find keeping the semantics of puts in my working memory to be harmful. The problem is that whereas (for instance) printf(...) is essentially an abbreviation for fprintf(stdout, ...), puts adds a newline whereas fputs does _not_. This is a headache to keep track of. The result of this is that I always use fputs to write a plain C string to a stdio handle, specifying stdout explicitly and adding newlines if needed, and I ignore puts entirely, much like I ignore gets. The convenience is not worth the subtle error-causing asymmetry and associated mnemonic pain, especially if that code may ever have to write somewhere other than stdout. |
|