We went through using C++ types in the recent past on this mailing list.
Points for discussion were:
- Possibly high overhead for long command lines - either time or space overhead.
- IIRC some platforms allow to modify the parameters or environment variables, which is actively used by some frameworks. Would this be supported by the C++ types?
-----Ursprüngliche Nachricht-----
Von: Hans Åberg via Std-Proposals <std-proposals@lists.isocpp.org>
Gesendet: Mi 23.07.2025 14:49
Betreff: Re: [std-proposals] D3803R0 More standard forms of main
An: std-proposals@lists.isocpp.org;
CC: Hans Åberg <haberg_1@icloud.com>;
The prototype should probably be
int main(const std::vector<std::string>& arg, const std::map<std::string, std::string>& env);
so that one gets the environmental variables sorted (ordering is not specified on POSIX). (There is a lot of overhead with std::unordered_map for small tables.)
I also see the primary reason for including it is that one can program with C++ types, which are more secure. And one does not need to worry about what exactly the OS is doing.