Date: Sat, 7 Sep 2024 19:47:10 +0200
So you want to spend standardization time on standardizing
int main(int argc, const char** argv) {
std::span<std::string_view> args(argv+1, argv+argc);
}
?
Seems like something that we shouldn't spend committee time on, but provide
as a starter program to beginners.
On Sat, Sep 7, 2024 at 5:37 PM Jeremy Rifkin via Std-Proposals <
std-proposals_at_[hidden]> wrote:
> Hello,
>
> I'd like to propose adding int main(std::span<std::string_view> args) as
> a standard signature for main.
>
> Motivation:
> - Modernization
> - Ergonomics
> - Teachability
> - Modern C++ through and through instead of 'what's a char**' and
> 'argv[1] == "--help" is a footgun, beware'
>
> Considerations:
> - There would be slight startup overhead in constructing the
> std::string_views and underlying array of string views, however, this
> would be entirely opt-in
> - It would probably add some implementation complexity
> - This would be an aspect of the core language which depends on the
> standard library. I don't love that, but, there is precedence for this
> sort of thing
> - Direct mutability of the argument contents would be lost
>
> I would make a reference implementation as part of the proposal.
>
>
> Cheers,
> Jeremy
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
>
int main(int argc, const char** argv) {
std::span<std::string_view> args(argv+1, argv+argc);
}
?
Seems like something that we shouldn't spend committee time on, but provide
as a starter program to beginners.
On Sat, Sep 7, 2024 at 5:37 PM Jeremy Rifkin via Std-Proposals <
std-proposals_at_[hidden]> wrote:
> Hello,
>
> I'd like to propose adding int main(std::span<std::string_view> args) as
> a standard signature for main.
>
> Motivation:
> - Modernization
> - Ergonomics
> - Teachability
> - Modern C++ through and through instead of 'what's a char**' and
> 'argv[1] == "--help" is a footgun, beware'
>
> Considerations:
> - There would be slight startup overhead in constructing the
> std::string_views and underlying array of string views, however, this
> would be entirely opt-in
> - It would probably add some implementation complexity
> - This would be an aspect of the core language which depends on the
> standard library. I don't love that, but, there is precedence for this
> sort of thing
> - Direct mutability of the argument contents would be lost
>
> I would make a reference implementation as part of the proposal.
>
>
> Cheers,
> Jeremy
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
>
Received on 2024-09-07 17:47:22