Date: Tue, 23 May 2017 02:10:23 +0200 From: Vincent Lefevre <vincent-o...@vinc17.net> Message-ID: <20170523001023.ga19...@zira.vinc17.org>
| If the intent were to have "int" everywhere related to sizes in the | printf context, then why is the second argument of snprintf of type | size_t instead of int? I doubt anyone really ever had a specific intent, the implementations just use "int" because anything bigger than 32000 is absurd anyway... It would be something of a surprise though if the size expected for the value obtained from a '*' and the values that could be handled via inline coding, were different - if larger values can be placed directly in the string, we'd have people going back to dynamically building format strings again, and that is really not something to be encouraged. snprintf was invented later, its 2nd arg is typically the result from sizeof (sometimes strlen), and hence is a size_t - not because anyone expected to have sizes that might not fit an int but would in a size_t. I have no opinion on whether processing should stop when an overflow occurs (however big the inline field width is supposed to be, some user can always write a bigger number, so it is always possible), or whether it should just continue (seems like a C std issue, rather than one for here.) kre