[ quantlib-Bugs-1859014 ] daycounters

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[ quantlib-Bugs-1859014 ] daycounters

SourceForge.net
Bugs item #1859014, was opened at 2007-12-27 18:25
Message generated for change (Comment added) made by lballabio
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=112740&aid=1859014&group_id=12740

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
>Status: Closed
>Resolution: Invalid
Priority: 5
Private: No
Submitted By: xinc (gigifaye29)
>Assigned to: Luigi Ballabio (lballabio)
Summary: daycounters

Initial Comment:
Several daycounter functions under
\QuantLib-0.8.1\ql\time\daycounters
use "swith" without a "break;" under each condition.

For example, the following one:

    Thirty360::implementation(Thirty360::Convention c) {
        switch (c) {
          case USA:
          case BondBasis:
            return boost::shared_ptr<DayCounter::Impl>(new US_Impl);
          case European:
          case EurobondBasis:
            return boost::shared_ptr<DayCounter::Impl>(new EU_Impl);
          case Italian:
            return boost::shared_ptr<DayCounter::Impl>(new IT_Impl);
          default:
            QL_FAIL("unknown 30/360 convention");
        }
    }

I believe there should be a "break;" ending each case. Otherwise the code actually implements each line till the end(default:...) regardless what 'c' is.

----------------------------------------------------------------------

>Comment By: Luigi Ballabio (lballabio)
Date: 2007-12-29 18:32

Message:
Logged In: YES
user_id=75450
Originator: NO

This is not a bug. When any of the cases is selected, a 'return' is
executed that exits the function immediately. This makes the break
unnecessary.

----------------------------------------------------------------------

You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=112740&aid=1859014&group_id=12740

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev