Re: Q enums in date.h
Posted by Luigi Ballabio-3 on Dec 21, 2000; 12:44pm
URL: http://quantlib.414.s1.nabble.com/Q-enums-in-date-h-tp1639p1640.html
At 12:11 PM 12/21/00 +0100, Gilbert Peffer wrote:
>Hi,
>Yes, I am currently delighting myself with reading code. My preferred
>pass-time ;-) I will send my questions and comments individually, as I go
>along, unless you prefer me to put all the stuff together in one mail.
One mail at the time is fine with me. Kind of keeps me company :)
>Enums: Do you mind explicitly assigning numbers to enum variables? I prefer
>not to leave it up to the compiler, and it makes it more readable for the
>less-versed C++ people.
Agreed, as far as I'm concerned.
> enum Weekday { Saturday = 1,
> Sunday = 2,
> ...
> Friday = 7 } ;
>
>Is it common to set Saturday as the first day in the week? Just that I can't
>remember...
I'll take the blame for this.
I think I assigned 0 to Saturday so that dayOfWeek() was simply
return Weekday(theSerialNumber%7)
instead of
return Weekday((theSerialNumber-1)%7)
In short, I must have had a nail in my head :)
Bye,
Luigi