Changes between Initial Version and Version 1 of Ticket #3666, comment 114
- Timestamp:
- 11/07/16 13:16:44 (8 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #3666, comment 114
initial v1 9 9 What's the ''semantics'' of {{{len}}} here? Is it the number of ''available'' bytes in the output buffer, or is it the number of ''desired'' bytes to fill it up with? You're mixing the two! When thinking in bytes, the number of ''available'' bytes is 64 in the current code, whereas the number of ''desired'' (or ''maximum'') bytes to which to format the string does not make sense. Why would you want to ask the formatter "hey format me this number, I give use a quite large buffer, but make sure not to write more than 11 bytes"? No sense whatsoever. It's the desired UI look you care about, in some locales it'll take 8 bytes, in some it'll take 11, in some it'll take even more. The formatter will know this, why should the caller care? If you specify a limit ''in bytes'', it should be because of technical limitation (the buffer being finite long). 10 10 11 Whereas, on the other hand, you might want to ask the same questions for ''width''. Here, the concept of ''available'' width in the buffer does not make any sense, whereas the number of''desired'' width, to which to format the string (which is 8 in my recent example), is an important one.11 Whereas, on the other hand, you might want to ask the same questions for ''width''. Here, the concept of ''available'' width in the buffer does not make any sense, whereas the ''desired'' width, to which to format the string (which is 8 in my recent example), is an important one. 12 12 13 13 You need to absolutely cleary separate all these conceps in your mind. Currently you're thiking about a washed-up mess of these. As long as you don't manage to separate these concepts, you won't be able to come up with proper code.