Article:
  What I Hate About Your Programming Language
Subject:   C Nitpick: exec* are not part of the language
Date:   2003-05-13 16:35:19
From:   anonymous2
Response to: C Nitpick: exec* are not part of the language

<blockquote>one of the reviewers gave me a good mnemonic</blockquote>
Care to share?
Full Threads Newest First

Showing messages 1 through 1 of 1.

  • C Nitpick: exec* are not part of the language
    2003-05-13 19:08:29  anonymous2 [View]

    I've never had any difficulty keeping printf, fprintf, sprintf, snprintf, vsprintf, vsnprintf, wsnprintf, etc. straight. For one thing, I almost never use sprintf() because of the possibility of buffer overflows. That aside, it's a pretty common convention in C to use 'n' in a function name to indicate a bounded buffer (strncpy comes to mind). I once saw a laughable use of strncat, though: this programmer evidently thought repeatedly strncat()'ing with the same buffer length would prevent buffer overflows.

    What does trip me up from time to time is the difference between fputs() and puts(). I keep expecting the stream (FILE) to come first, although I'm getting better at it. I often have trouble remembering whether putchar() or putc() writes to stdout Sometimes I just wish they wouldn't have these convenient shortcuts, and just make you specify stdout explicitly.