Click here to Skip to main content
15,908,661 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Interthread messaging Pin
Joaquín M López Muñoz30-Jan-02 9:45
Joaquín M López Muñoz30-Jan-02 9:45 
GeneralRe: Interthread messaging Pin
30-Jan-02 10:09
suss30-Jan-02 10:09 
GeneralRe: Interthread messaging Pin
Joaquín M López Muñoz30-Jan-02 10:17
Joaquín M López Muñoz30-Jan-02 10:17 
Generaltrying to clear History from IE Pin
TigerNinja_30-Jan-02 8:58
TigerNinja_30-Jan-02 8:58 
GeneralAccessing Excel Cells from Visual C++ Pin
Havoc30-Jan-02 7:13
Havoc30-Jan-02 7:13 
GeneralRe: Accessing Excel Cells from Visual C++ Pin
Richard Ellis30-Jan-02 12:14
Richard Ellis30-Jan-02 12:14 
GeneralRe: Accessing Excel Cells from Visual C++ Pin
wangyiming30-Jan-02 14:33
wangyiming30-Jan-02 14:33 
QuestionBad Coding? Pin
James R. Twine30-Jan-02 6:42
James R. Twine30-Jan-02 6:42 
   I bumped into this sad example while working with a "professional" charting library that I am forced to use. This code (changed to protect the guilty) comes from the drawing code in one of the charting code's base classes
<br />
    switch( dwSomeValue )<br />
    {<br />
        case SOME_CHARTTYPE1:<br />
        case SOME_CHARTTYPE2:<br />
        case SOME_CHARTTYPE3:<br />
        case SOME_CHARTTYPE4:<br />
        case SOME_CHARTTYPE5:<br />
        {<br />
            //<br />
            // Some Code...<br />
            //<br />
            break;<br />
        }<br />
        default:<br />
        case SOME_CHARTTYPE6:<br />
        case SOME_CHARTTYPE7:<br />
        case SOME_CHARTTYPE8:<br />
        case SOME_CHARTTYPE9:<br />
        case SOME_CHARTTYPE10:<br />
        {<br />
            //<br />
            // Some Other Code...<br />
            //<br />
        }<br />
    }<br />


   So now when a custom value (chart) is added, for example "SOME_NEW_CHARTTYPE11", the "Some Other Code" code block always gets executed, because the "default:" was placed in the middle of the switch statement, with no "break;" after it! OMG | :OMG:

   Now, I may be wrong here, but I am pretty sure that this is a bug in the charting class' code.  What I really want to know is, can anyone provide me with an example where (mis)using a "default" in the middle of a switch statement like this is a good idea?

   Peace!

-=- James.
AnswerRe: Bad Coding? Pin
Roger Allen30-Jan-02 6:56
Roger Allen30-Jan-02 6:56 
GeneralRe: Bad Coding? Pin
James R. Twine30-Jan-02 7:04
James R. Twine30-Jan-02 7:04 
AnswerRe: Bad Coding? Pin
Igor Proskuriakov30-Jan-02 7:15
Igor Proskuriakov30-Jan-02 7:15 
GeneralRe: Bad Coding? Pin
James R. Twine30-Jan-02 8:48
James R. Twine30-Jan-02 8:48 
AnswerRe: Bad Coding? Pin
Chris Losinger30-Jan-02 9:02
professionalChris Losinger30-Jan-02 9:02 
AnswerRe: Bad Coding? Pin
Joaquín M López Muñoz30-Jan-02 9:08
Joaquín M López Muñoz30-Jan-02 9:08 
GeneralChange the date of file! Pin
Mazdak30-Jan-02 6:14
Mazdak30-Jan-02 6:14 
GeneralRe: Change the date of file! Pin
Ravi Bhavnani30-Jan-02 6:24
professionalRavi Bhavnani30-Jan-02 6:24 
Generalstring usage problem Pin
30-Jan-02 6:00
suss30-Jan-02 6:00 
GeneralRe: string usage problem Pin
Joaquín M López Muñoz30-Jan-02 7:51
Joaquín M López Muñoz30-Jan-02 7:51 
GeneralC++ Macros in Visual C++ Pin
30-Jan-02 5:18
suss30-Jan-02 5:18 
GeneralRe: C++ Macros in Visual C++ Pin
Bill Wilson30-Jan-02 10:14
Bill Wilson30-Jan-02 10:14 
GeneralForaging for Suggestions Pin
Roger Wright30-Jan-02 5:05
professionalRoger Wright30-Jan-02 5:05 
Generala question about exit() method Pin
Gérald Mercet30-Jan-02 4:59
Gérald Mercet30-Jan-02 4:59 
GeneralRe: a question about exit() method Pin
Ravi Bhavnani30-Jan-02 5:05
professionalRavi Bhavnani30-Jan-02 5:05 
GeneralRe: a question about exit() method Pin
Gérald Mercet30-Jan-02 5:17
Gérald Mercet30-Jan-02 5:17 
Generalloading bitmaps Pin
Rajveer30-Jan-02 4:13
Rajveer30-Jan-02 4:13 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.