program arguments in module constructor?

Johan Granberg lijat.meREM at OVEgmail.com
Fri May 19 12:43:18 PDT 2006


Derek Parnell wrote:
> I don't understand what is the effective difference between what you want
> and ...
> 
>  //file.d
>  void main(char[][] args)
>  {
>  	someFunk(args);
>  	runProgram();
>  }
>  //end of file
> 
> Why is it essential that the initialization be performed by the module ctor
> rather than the first function called by main()?
> 
> I can understand your desire from a stylistic POV but not from a purely
> run-time operational POV.
> 

It would not matter and I would not bother if it was a program I was 
developing. But because it is a library I'm developing it would bee an 
unclean API interface and a source of problems when users forget to add 
the InitLibrary function at the first line of main and get unpredictable 
errors.

Anyway my initial post was mostly a question about the possibility of 
such a mechanism. I will probably use a init function and require it to 
bee at the firs line of main.



More information about the Digitalmars-d mailing list