-
Notifications
You must be signed in to change notification settings - Fork 67
03. Why not format string?
The use of format strings was a historical mistake. Originally designed in the 1970s by AT&T Labs, format strings aimed to avoid adding excessive complexity to the language and prevent language dependencies on I/O facilities. However, format strings are vulnerable to attacks, and there’s no straightforward fix. Even restricting format strings to compile-time only doesn’t fully address the issue (macros can still pose hazards and introduce localization challenges).
One could argue that format strings remain problematic even for localization, as they can be represented purely in binary form. C++20’s std::format
lacks features essential for tools like GNU gettext, and finding an elegant solution without increasing complexity is challenging.
In this library, you will not encounter format strings; they are unnecessary.