Skip to content

Commit 3e85a00

Browse files
author
Florian Thake
committed
BUILD: Support Visual Studio 2022 17.13 with C++23 preview.
FIX: C++23 - Printing without libfmt. Use std::print again instead of std::vprint_unicode. ... On Linux it just works, ... on Windows with VS 17.13 at least in Windows Terminal (but not in old conhost.exe). 3RDPARTY|HOST: updated to fmt 11.1.4, hard minimum is still 10.1.1
1 parent ac9dd6e commit 3e85a00

2 files changed

Lines changed: 13 additions & 5 deletions

File tree

changelog.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,13 @@ NOTE: The dates are not the release dates, but a last commit date.
88
================
99
VERSION 0.16.0 (not released yet, pre-release)
1010
================
11+
BUILD: Support Visual Studio 2022 17.13 with C++23 preview.
12+
FIX: C++23 - Printing without libfmt. Use std::print again instead of std::vprint_unicode.
13+
... On Linux it just works,
14+
... on Windows with VS 17.13 at least in Windows Terminal (but not in old conhost.exe).
15+
16+
3RDPARTY|HOST: updated to fmt 11.1.4, hard minimum is still 10.1.1
17+
1118
CORELIB|JSON: added experimental BSON support if nlohmann::json Adapter is used.
1219
- added readbsonbuffer and writebsonbuffer to core library for ...
1320
... Tuple <--> BSON Buffer conversion.

include/teascript/Print.hpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@
2525

2626
// Priority order:
2727
// 1.) Use fmt::print if available (this will offer the most possible features, e.g. colored output, string formatting within script code, etc...)
28-
// 2.) Use std::vprint_unicode if available.
29-
// 3.) Use std::cout + std::format
28+
// 2.) Use C++23 std::print if available.
29+
// 3.) Use C++20 std::cout + std::format
3030
#if __has_include( "fmt/format.h" ) && !defined( TEASCRIPT_DISABLE_FMTLIB )
3131
# define TEASCRIPT_FMTFORMAT 1
3232
# ifndef TEASCRIPT_DISABLE_FMT_HEADER_ONLY
@@ -40,7 +40,8 @@
4040
# endif
4141
#elif __has_include( <format> )
4242
# include <format>
43-
# if defined( __cpp_lib_format ) && __cpp_lib_format > 202110L && __cplusplus > 202002L && !defined( TEASCRIPT_DISABLE_STDFORMAT_23 )
43+
// for Visual Studio we not only need C++23 but also at least VS 2022 17.13 with C++23 preview for have a working std::print with UTF-8 support.
44+
# if defined( __cpp_lib_format ) && __cpp_lib_format > 202110L && __cplusplus > 202002L && !defined( TEASCRIPT_DISABLE_STDFORMAT_23 ) && (!defined(_MSC_VER) || _MSC_VER >= 1943)
4445
# define TEASCRIPT_STDFORMAT_23 1
4546
# include <print>
4647
# else
@@ -60,8 +61,8 @@
6061
# define TEASCRIPT_PRINT( ... ) fmt::print( __VA_ARGS__ )
6162
# define TEASCRIPT_ERROR( ... ) fmt::print( stderr, __VA_ARGS__ )
6263
#elif TEASCRIPT_STDFORMAT_23
63-
# define TEASCRIPT_PRINT( ... ) std::vprint_unicode( __VA_ARGS__ )
64-
# define TEASCRIPT_ERROR( ... ) std::vprint_unicode( stderr, __VA_ARGS__ )
64+
# define TEASCRIPT_PRINT( ... ) std::print( __VA_ARGS__ )
65+
# define TEASCRIPT_ERROR( ... ) std::print( stderr, __VA_ARGS__ )
6566
#elif TEASCRIPT_STDFORMAT_20
6667
// NOTE: On Windows you must most likely hook up the streambuf of std::cout/std::cerr for support full UTF-8
6768
# define TEASCRIPT_PRINT( ... ) std::cout << std::format( __VA_ARGS__ )

0 commit comments

Comments
 (0)