C++ Logo

sg16

Advanced search

Re: [isocpp-lib-ext] std::environment

From: Ville Voutilainen <ville.voutilainen_at_[hidden]>
Date: Mon, 2 Jan 2023 01:28:18 +0200
On Mon, 2 Jan 2023 at 01:20, Ville Voutilainen
<ville.voutilainen_at_[hidden]> wrote:

> > POLL: std::environment should be immutable
> This poll defeats the purpose of the facility. If I'll get a portable
> replacement for getenv(), I shouldn't need to use putenv() either any
> more. We should expose the capabilities of the system-specific
> facilities we wrap into a portable API, not hide them behind
> idealistic
> APIs that don't allow something like setting an environment variable.
> The environment is already global mutable state, and it's not
> the job of std::environment to pretend otherwise, if you ask me. This
> poll is also suggesting that we leave room for a language underneath
> C++ here, and we shouldn't do that, in principle.

I should perhaps add that there is existing practice, here:
https://doc.qt.io/qt-6/qtglobal.html#qputenv

I'm fully aware that qgetenv() and qEnvironmentVariable() have
different data-loss behaviors on different
platforms, so that part is a bit quirky to take as existing practice
to consider for standardization. :)

Received on 2023-01-01 23:28:31