| Deutsch English Français Italiano |
|
<vl6gh2$3e4rd$2@dont-email.me> View for Bookmarking (what is this?) Look up another Usenet article |
Path: news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail
From: David Brown <david.brown@hesbynett.no>
Newsgroups: comp.lang.c++
Subject: Re: We have a new standard!
Date: Thu, 2 Jan 2025 17:57:06 +0100
Organization: A noiseless patient Spider
Lines: 40
Message-ID: <vl6gh2$3e4rd$2@dont-email.me>
References: <C++-20241227154547@ram.dialup.fu-berlin.de>
<20250101182527.00004b2f@yahoo.com> <vl3qpk$2rr3n$1@dont-email.me>
<vl5dst$37mo5$2@dont-email.me> <vl5lvf$39de4$1@dont-email.me>
<vl625a$3bj9b$1@dont-email.me> <20250102173514.0000191d@yahoo.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 02 Jan 2025 17:57:06 +0100 (CET)
Injection-Info: dont-email.me; posting-host="0fcb1a720205bec4fee800415cc3ccab";
logging-data="3609453"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+Exb//kkx+dQLhdgPnU+3Ouf3U++UcTB4="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.11.0
Cancel-Lock: sha1:gJjuqwI5rQpVFwHLJvj95eVcG7c=
Content-Language: en-GB
In-Reply-To: <20250102173514.0000191d@yahoo.com>
On 02/01/2025 16:35, Michael S wrote:
> On Thu, 2 Jan 2025 13:51:53 +0100
> David Brown <david.brown@hesbynett.no> 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 <cstdio>
> #include <format>
>
> 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.
>
<https://en.cppreference.com/w/cpp/utility/format/format>
Apparently P2216R3 made compile-time checks for std::format a
requirement. I don't know where that fits with standard versions, or
compiler support. I am just going by what it says in the reference here.