Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions include/fmt/base.h
Original file line number Diff line number Diff line change
Expand Up @@ -2898,8 +2898,9 @@ FMT_INLINE void print(format_string<T...> fmt, T&&... args) {
vargs<T...> va = {{args...}};
if FMT_CONSTEXPR20 (!detail::use_utf8)
return detail::vprint_mojibake(stdout, fmt.str, va, false);
detail::is_locking<T...>() ? vprint_buffered(stdout, fmt.str, va)
: vprint(fmt.str, va);
else
detail::is_locking<T...>() ? vprint_buffered(stdout, fmt.str, va)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would 'return' in else branch follow code style as in if constexpr path?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer removing the return from the if branch

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Either way is good to me, the proposal is to follow one pattern/style

: vprint(fmt.str, va);
}

/**
Expand All @@ -2915,8 +2916,9 @@ FMT_INLINE void print(FILE* f, format_string<T...> fmt, T&&... args) {
vargs<T...> va = {{args...}};
if FMT_CONSTEXPR20 (!detail::use_utf8)
return detail::vprint_mojibake(f, fmt.str, va, false);
detail::is_locking<T...>() ? vprint_buffered(f, fmt.str, va)
: vprint(f, fmt.str, va);
else
detail::is_locking<T...>() ? vprint_buffered(f, fmt.str, va)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would 'return' in else branch follow code style as in if constexpr path?

: vprint(f, fmt.str, va);
}

/// Formats `args` according to specifications in `fmt` and writes the output
Expand All @@ -2925,7 +2927,7 @@ template <typename... T>
FMT_INLINE void println(FILE* f, format_string<T...> fmt, T&&... args) {
vargs<T...> va = {{args...}};
if FMT_CONSTEXPR20 (detail::use_utf8) return vprintln(f, fmt.str, va);
detail::vprint_mojibake(f, fmt.str, va, true);
else detail::vprint_mojibake(f, fmt.str, va, true);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would 'return' in else branch follow code style as in if constexpr path?

}

/// Formats `args` according to specifications in `fmt` and writes the output
Expand Down