-
Notifications
You must be signed in to change notification settings - Fork 699
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove redundant ostream manipulators (#444)
* remove redundant ostream manipulators The following manipulators are sticky, and do not have to be repeated for every item: - setiosflags, resetiosflags, setbase, setfill, setprecision - [no]boolalpha, [no]showbase, [no]showpoint, [no]showpos, [no]skipws, [no]unitbuf, [no]uppercase - dec, hex, oct - fixed, scientific - internal, left, right The only not sticky or persistent manipulator is setw, because all output operators provided by the C++ library reset the width by calling width(0) when beeing done. Therefore the following test code works without any problem: ostringstream sfill; ostringstream sopti; sfill << hex << setfill('0') << setw(2) << 12 << hex << setfill('0') << setw(2) << 34 << hex << setfill('0') << setw(2) << 56; sopti << hex << setfill('0') << setw(2) << 12 << setw(2) << 34 << setw(2) << 56; assert(sfill.str() == sopti.str()); The code savings using gcc 7.5.0 are as follows: unoptimized 416432 9344 416 426192 680d0 libvsomeip3-cfg.so.3.3.0 49431 2760 8 52199 cbe7 libvsomeip3-e2e.so.3.3.0 355217 11984 696 367897 59d19 libvsomeip3-sd.so.3.3.0 2359943 65976 4336 2430255 25152f libvsomeip3.so.3.3.0 19967 1392 648 22007 55f7 examples/notify-sample 18912 1792 648 21352 5368 examples/subscribe-sample 20113 1456 648 22217 56c9 examples/request-sample 15131 1360 648 17139 42f3 examples/response-sample optimized 416260 9344 416 426020 68024 libvsomeip3-cfg.so.3.3.0 49431 2760 8 52199 cbe7 libvsomeip3-e2e.so.3.3.0 353693 11984 696 366373 59725 libvsomeip3-sd.so.3.3.0 2343495 65976 4336 2413807 24d4ef libvsomeip3.so.3.3.0 19967 1392 648 22007 55f7 examples/notify-sample 18255 1792 648 20695 50d7 examples/subscribe-sample 19143 1456 648 21247 52ff examples/request-sample 15003 1360 648 17011 4273 examples/response-sample Signed-off-by: Roman Fietze <[email protected]> * fix missing whitespace after output operator Signed-off-by: Roman Fietze <[email protected]> --------- Signed-off-by: Roman Fietze <[email protected]>
- Loading branch information
Showing
34 changed files
with
819 additions
and
717 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.