Return value from getopt?

Janice Caron caron800 at googlemail.com
Wed Jan 23 06:40:54 PST 2008


On Jan 23, 2008 2:26 PM, Jarrett Billingsley <kb3ctd2 at yahoo.com> wrote:
> You don't have to guess.  The source code for Phobos is available for your
> perusal in every D compiler distribution.  And you're right, it just returns
> true for success and false for failure.

Good point. I hadn't thought of that. For some mad reason I keep
expecting the documentation to be enough! :-)


> > If the second case, please can the function signature be changed to
> > return void, and an exception thrown on error?
>
> It probably should..

In that case, I'd like to request of Walter that this be changed.
Otherwise, all of my code which uses getopt will have to do lots of
ugly error checking of the return code. Moreover, if it fails, there's
no obvious way to find out why it failed, wheras an exception could
carry that information.



More information about the Digitalmars-d mailing list