Custom Format Placeholders
There are a few implementations of printf
-like functions that allow extensions to the escape-character-based mini-language, thus allowing the programmer to have a specific formatting function for non-builtin types. One of the most well-known is the (now deprecated) glibc's register_printf_function
. However, it is rarely used due to the fact that it conflicts with static format string checking. Another is Vstr custom formatters, which allows adding multi-character format names, and can work with static format checkers.
Some applications (like the Apache HTTP Server) include their own printf
-like function, and embed extensions into it. However these all tend to have the same problems that register_printf_function
has.
Most non-C languages that have a printf
-like function work around the lack of this feature by just using the "%s
" format and converting the object to a string representation. C++ offers a notable exception, in that it has a printf
function inherited from its C history, but also has a completely different mechanism that is preferred.
Read more about this topic: Printf Format String
Famous quotes containing the word custom:
“In the west, Apollo and Dionysus strive for victory. Apollo makes the boundary lines that are civilization but that lead to convention, constraint, oppression. Dionysus is energy unbound, mad, callous, destructive, wasteful. Apollo is law, history, tradition, the dignity and safety of custom and form. Dionysus is the new, exhilarating but rude, sweeping all away to begin again. Apollo is a tyrant, Dionysus is a vandal.”
—Camille Paglia (b. 1947)