C++ Logo

std-proposals

Advanced search

Re: [std-proposals] A draft for a std::arguments proposal

From: Thiago Macieira <thiago_at_[hidden]>
Date: Tue, 01 Oct 2024 14:06:03 -0700
On Monday 30 September 2024 23:50:30 GMT-7 Tiago Freire via Std-Proposals
wrote:
> If it's zero-cost carry on, but when you present interfaces such as
> std::arguments.at(1) this would suggest at least a global object, which
> wouldn't be zero-cost. Then you have an accessor method at, which on
> Windows if it was stateless would require always parsing up to the token n,
> which would be extremely inefficient, not to mention unimplementable due to
> the presence of escape characters while you return a view.

UCRT already saves argc and argv/wargv on its own. Therefore, it's zero
marginal cost to access those and there's no tokenisation required.

The only issue is that only one of argv or wargv are saved, depending on how
the program was compiled. Therefore, std::arguments may return null/empty for
the 8-bit .at() and only return contents for the UTF-16 equivalent --
std::warguments?

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
  Principal Engineer - Intel DCAI Platform & System Engineering

Received on 2024-10-01 21:06:13