C++ Logo

std-proposals

Advanced search

Re: [std-proposals] D3803R0 More standard forms of main

From: Sebastian Wittmeier <wittmeier_at_[hidden]>
Date: Wed, 23 Jul 2025 18:08:34 +0200
With Linux it is possible to have 256 KiB on the command line, perhaps more   https://stackoverflow.com/questions/33051108/how-to-get-around-the-linux-too-many-arguments-limit/33278482#33278482     IIRC There are frameworks, which are sensitive to some command-line options. Those options are processed and then removed from the command line.   It is more often the case that the environment is changed within the program.     -----Ursprüngliche Nachricht----- Von:Hans Åberg <haberg_1_at_[hidden]> Gesendet:Mi 23.07.2025 18:06 Betreff:Re: [std-proposals] D3803R0 More standard forms of main An:std-proposals_at_[hidden]; CC:Sebastian Wittmeier <wittmeier_at_[hidden]>; To begin with, one would not be required to use the types. Maximum POSIX command line length is 2048, though some OSs may have a higher limit. One could admit string_view as well. I think of starting new processes with execve, which provides variables. For what purpose are the arguments and environment modified? > On 23 Jul 2025, at 15:38, Sebastian Wittmeier via Std-Proposals <std-proposals_at_[hidden]> wrote: > > AW: [std-proposals] D3803R0 More standard forms of main body { font-family: Arial, Verdana, Sans-Serif ! important; font-size: 12px; padding: 5px 5px 5px 5px; margin: 0px; border-style: none; background-color: #ffffff; } p, ul, li { margin-top: 0px; margin-bottom: 0px; } 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_at_[hidden]> > Gesendet: Mi 23.07.2025 14:49 > Betreff: Re: [std-proposals] D3803R0 More standard forms of main > An: std-proposals_at_[hidden]; > CC: Hans Åberg <haberg_1_at_[hidden]>; > 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. >   > -- > Std-Proposals mailing list > Std-Proposals_at_[hidden] > https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals

Received on 2025-07-23 16:18:22