Path: ...!weretis.net!feeder9.news.weretis.net!news.quux.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail From: Michael S Newsgroups: comp.lang.c++ Subject: Re: We have a new standard! Date: Thu, 2 Jan 2025 17:35:14 +0200 Organization: A noiseless patient Spider Lines: 33 Message-ID: <20250102173514.0000191d@yahoo.com> References: <20250101182527.00004b2f@yahoo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Injection-Date: Thu, 02 Jan 2025 16:35:17 +0100 (CET) Injection-Info: dont-email.me; posting-host="a487b285b1ee649d033fecbdc1f1f405"; logging-data="3518458"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX188lC4YkAslaskidW5KEHGJqKnbZzzDp9c=" Cancel-Lock: sha1:HQ13MdUPiZU3vEBEia/KEp86wr8= X-Newsreader: Claws Mail 4.1.1 (GTK 3.24.34; x86_64-w64-mingw32) Bytes: 2044 On Thu, 2 Jan 2025 13:51:53 +0100 David Brown wrote: > > Could this all have been done from the start of C++? In theory, yes > - in practice no. std::format and std::print rely on various modern > C++ features, such as compile-time evaluation of functions, It does not look like dependence of std::format on compile-time evaluation is a requirement of standard rather than implementation choice of g++ and of clang++. MSVC 19.30.30706 compiles the following code just fine: #include #include int main(int argc, char** argv) { if (argc >= 3) { std::string s = std::format(argv[1], argv[2]); printf("%s\n", s.c_str()); } return 0; } When run, it produces expected results. Or, may be, it's because this version of MSVC is not fully C++20 complient.