-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Open
Labels
examples-2026An issue that is relevant for examples we are trying to port to Carbon in 2026.An issue that is relevant for examples we are trying to port to Carbon in 2026.leads questionA question for the leads teamA question for the leads team
Description
Summary of issue:
We need to somehow expose command-line arguments to Carbon programs. So far the toolchain permits fn Run() and fn Run -> i32, with no support for arguments. But even that is not covered by any proposal I can find.
Details:
#2550 established that the entry point is named Run in the Main package, but did not specify what signatures it can have.
Any other information that you want to share?
C++ allows:
int main();
int main() noexcept;
int main(int, char**);
int main(int, char**) noexcept;Implementations often also allow the return type to be declared as void, and some allow a third char** envp parameter.
Some platforms have their own convention, such as WinMain on Windows.
The toolchain allows the return type to be omitted. When this happens, the return value is currently uninitialized, rather than being set to 0.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
examples-2026An issue that is relevant for examples we are trying to port to Carbon in 2026.An issue that is relevant for examples we are trying to port to Carbon in 2026.leads questionA question for the leads teamA question for the leads team