mirror of
https://github.com/shadps4-emu/ext-fmt.git
synced 2024-11-30 21:20:22 +00:00
Mention a POSIX extension of printf.
This commit is contained in:
parent
280ea8b5c5
commit
cb458293a3
36
README.rst
36
README.rst
@ -39,12 +39,14 @@ Printf
|
|||||||
~~~~~~
|
~~~~~~
|
||||||
|
|
||||||
The good thing about printf is that it is very fast and readily available
|
The good thing about printf is that it is very fast and readily available
|
||||||
being the part of the C standard library. The main drawbacks are that it
|
being the part of the C standard library. The main drawback is that it
|
||||||
doesn't support user-defined types, it is unsafe although the latter
|
doesn't support user-defined types. Printf also has safety issues although
|
||||||
problem is mostly solved with `__attribute__ ((format (printf, ...))
|
they are mostly solved with `__attribute__ ((format (printf, ...))
|
||||||
<http://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html>`__ in GCC
|
<http://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html>`__ in GCC.
|
||||||
and it doesn't support positional arguments required for `i18n
|
There is a POSIX extension that adds positional arguments required for
|
||||||
<http://en.wikipedia.org/wiki/Internationalization_and_localization>`__.
|
`i18n <http://en.wikipedia.org/wiki/Internationalization_and_localization>`__
|
||||||
|
to printf but it is not a part of C99 and may not be available on some
|
||||||
|
platforms.
|
||||||
|
|
||||||
IOStreams
|
IOStreams
|
||||||
~~~~~~~~~
|
~~~~~~~~~
|
||||||
@ -58,8 +60,8 @@ which is a lot of typing compared to printf::
|
|||||||
printf("%.2f\n", 1.23456);
|
printf("%.2f\n", 1.23456);
|
||||||
|
|
||||||
Matthew Wilson, the author of FastFormat referred to this situations with
|
Matthew Wilson, the author of FastFormat referred to this situations with
|
||||||
IOStreams as "chevron hell".
|
IOStreams as "chevron hell". IOStreams doesn't support positional arguments
|
||||||
As with printf, there is no chance to support i18n.
|
by design.
|
||||||
|
|
||||||
The good part is that IOStreams supports user-defined types and is safe
|
The good part is that IOStreams supports user-defined types and is safe
|
||||||
although error reporting is awkward.
|
although error reporting is awkward.
|
||||||
@ -69,10 +71,9 @@ Boost Format library
|
|||||||
|
|
||||||
This is a very powerful library which supports both printf-like format
|
This is a very powerful library which supports both printf-like format
|
||||||
strings and positional arguments. The main its drawback is performance.
|
strings and positional arguments. The main its drawback is performance.
|
||||||
According to various benchmarks it is so slow that I wouldn't recommend
|
According to various benchmarks it is much slower than other methods
|
||||||
it for purposes other than occasional message reporting in small to medium
|
considered here. Boost Format also has excessive build times and severe
|
||||||
size projects that are not performance-critical. It also has excessive
|
code bloat issues (see `Benchmarks`_).
|
||||||
build times and severe code bloat issues (see `Benchmarks`_).
|
|
||||||
|
|
||||||
FastFormat
|
FastFormat
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
@ -203,8 +204,9 @@ Acknowledgments
|
|||||||
|
|
||||||
The benchmark section of this readme file and the performance tests are taken
|
The benchmark section of this readme file and the performance tests are taken
|
||||||
from the excellent `tinyformat <https://github.com/c42f/tinyformat>`__ library
|
from the excellent `tinyformat <https://github.com/c42f/tinyformat>`__ library
|
||||||
written by Chris Foster. boost::format is acknowledged transitively since
|
written by Chris Foster. Boost Format library is acknowledged transitively
|
||||||
it had some influence on tinyformat. Some ideas used in the implementation
|
since it had some influence on tinyformat.
|
||||||
are borrowed from `Loki <http://loki-lib.sourceforge.net/>`__ SafeFormat and
|
Some ideas used in the implementation are borrowed from `Loki
|
||||||
`Diagnostic API <http://clang.llvm.org/doxygen/classclang_1_1Diagnostic.html>`__
|
<http://loki-lib.sourceforge.net/>`__ SafeFormat and `Diagnostic API
|
||||||
in `Clang <http://clang.llvm.org/>`__.
|
<http://clang.llvm.org/doxygen/classclang_1_1Diagnostic.html>`__ in
|
||||||
|
`Clang <http://clang.llvm.org/>`__.
|
||||||
|
Loading…
Reference in New Issue
Block a user