3 ms·
Create an adapter: int main(int argc, char **argv) { return myMain(argv[0 .. argc]); } Strings can be done like this: char [..] s = p[0 .. strlen(p)]
by WalterBright 4y ago
Create an adapter:
int main(int argc, char **argv) { return myMain(argv[0 .. argc]); }
Strings can be done like this:
char [..] s = p[0 .. strlen(p)];
- elcritch 4y agoHmmm, the "[..]" is a fat pointer right? Couldn't you just say: int main(char [..] args) Maybe with some way to tell the compiler the correct parameter order if needed? Perhaps: int main(char [..argc] argv) I'm curious if ELF and other formats have enough info to figure that mapping out?
- WalterBright 4y ago> the "[..]" is a fat pointer right? yes > if ELF and other formats have enough info to figure that mapping out? No, as there is no semantic connection between `argc` and `argv`.