Women in Technology

Hear us Roar



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

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.