Skip to content

Commit 4cbba79

Browse files
serge-sans-pailleshravanrn
authored andcommitted
Reduce dependency to <iostream> in header
<iostream> comes with global constructors (to initialize std::cout, std::cerr and the likes) and is a rather large header on its own. Having it in a header impacts all compilation unit that include this header. Use <cstdio> instead for the simple formatting used in rlbox_helpers.hpp.
1 parent 2ffb438 commit 4cbba79

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

code/include/rlbox_helpers.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// IWYU pragma: friend "rlbox_.*\.hpp"
44

55
#include <cstdlib>
6-
#include <iostream>
6+
#include <cstdio>
77
#include <stdexcept>
88
#include <type_traits>
99
#include <utility>
@@ -27,7 +27,7 @@ namespace detail {
2727
#ifdef RLBOX_CUSTOM_ABORT
2828
RLBOX_CUSTOM_ABORT(msg);
2929
#else
30-
std::cerr << msg << std::endl;
30+
fprintf(stderr, "%s\n", msg);
3131
std::abort();
3232
#endif
3333
#endif
@@ -65,11 +65,11 @@ namespace detail {
6565
void printTypes()
6666
{
6767
#if defined(__clang__) || defined(__GNUC__) || defined(__GNUG__)
68-
std::cout << __PRETTY_FUNCTION__ << std::endl; // NOLINT
68+
puts(__PRETTY_FUNCTION__); // NOLINT
6969
#elif defined(_MSC_VER)
70-
std::cout << __FUNCSIG__ << std::endl; // NOLINT
70+
puts(__FUNCSIG__); // NOLINT
7171
#else
72-
std::cout << "Unsupported" << std::endl;
72+
puts("Unsupported");
7373
#endif
7474
}
7575

0 commit comments

Comments
 (0)