Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
C Programming
String concatenation function, request for comments.
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="Eric Sosman, post: 2416305"] Agreed. My point is that if even the inventor of the interface can make such a simple oversight, the interface may in and of itself be error-prone. It's at least worth giving thought to what sort of interface might be less likely to be, er, oversought. This particular error isn't as bad as it used to be in the pre- Standard days, because if there's a prototype for vast() in scope the compiler will catch the omission. The same can't be said for using a sentinel; the compiler will *not* catch a failure to append `(char*)NULL' after the "real" arguments. This leaves you with a balancing act: The existing interface may provoke more coding errors that the compiler will catch, while a sentinel method might provoke fewer errors but nastier. Note that the compiler will not detect the problem in tmp = vast(4, "Welcome to ", HOST, ", you are logged in as ", name, "."); or (worse) in #define HOST "kremvax" ... tmp = vast(5, "Welcome to " HOST ", you are logged in as ", name, "."); That is, omitting the count is not the only error mode you need to think about. [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
C Programming
String concatenation function, request for comments.
Top