const main args?
bearophile
bearophileHUGS at lycos.com
Fri Aug 12 14:51:50 PDT 2011
Steven Schveighoffer:
> > int main(in string[] args);
>
> What would be the purpose of this?
Why do you use "in" in function arguments? To make sure you will not modify the given array. I think it's not good practice to change the length of the input strings of the main or replace it with another dynamic array at runtime.
On the other hand in D const is transitive, and currently you can't do many things on a const array (like several std.algorithms). So currently that "in" restricts too much the things you are allowed to do with args. This is why I have asked for an opinion, to understand the balance of the pros and cons.
Bye,
bearophile
More information about the Digitalmars-d-learn
mailing list