C++ Logo


Advanced search

Re: [std-proposals] constexpr support in std::filesystem API

From: Andrey Semashev <andrey.semashev_at_[hidden]>
Date: Tue, 12 Mar 2024 15:23:28 +0300
On 3/12/24 14:42, Marcin Jaczewski via Std-Proposals wrote:
> If it would be allowed then it should only be read-only access,
> allowing writing is only asking for problems (not reproducible builds
> and even worse exploits and hacks).
> Not to mention that now we will have `#embed` that allows reading files.

This would mean that compilation result would depend on the state of the
filesystem. And, potentially, the availability of system resources (e.g.
file descriptors) during compilation.

Aside from the obvious issues with reproducible builds, I think this
contradicts the whole idea of constant expressions, which is that the
expressions, well, must be constant, i.e. produce the same result on
every compilation.

> wt., 12 mar 2024 o 12:32 Andrei Grosu via Std-Proposals
> <std-proposals_at_[hidden]> napisał(a):
>> The proposal is simple: constexpr support for the filesystem API.
>> The need comes from writing a build system in (modern) C++.
>> If there is support for compile-time access to the filesystem , it would be , in my opinion, the key missing piece for a build system implemented in modern C++.
>> Without that you would have to depend on code generation , but with it , there is not much missing to build a fully featured build system in C++ itself.
>> Is this a question of compiler complexity , to enable constexpr filesystem access ? It is not clear to me if there are other factors at play.
>> Can anyone ‘in the know’ share some insights why it might or might not be feasable ?
>> --
>> Std-Proposals mailing list
>> Std-Proposals_at_[hidden]
>> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals

Received on 2024-03-12 12:23:31