Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
F
fmt
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
fmt
Commits
cb458293
Commit
cb458293
authored
Dec 09, 2012
by
Victor Zverovich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Mention a POSIX extension of printf.
parent
280ea8b5
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
17 deletions
+19
-17
README.rst
README.rst
+19
-17
No files found.
README.rst
View file @
cb458293
...
@@ -39,12 +39,14 @@ Printf
...
@@ -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::
...
@@ -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 i18
n.
by desig
n.
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
...
@@ -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
...
@@ -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/>`__.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment