|
|
|
|
|
by cremno
4089 days ago
|
|
I agree, but I don't think mentioning such an exception is a good idea. That's basically the same reason why gets() is part of ISO C90 and C99. Just call snprintf() even in such cases and forget about sprintf(). From http://www.open-std.org/jtc1/sc22/wg14/www/C99RationaleV5.10..., PDF page 163: >The Committee decided that gets was useful and convenient in those special circumstances when the programmer does have adequate control over the input, and as longstanding existing practice, it needed a standard specification. |
|
For the record, when writing new code, I'd strongly recommend that people consider using asprintf instead of either function.