Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. a question about check box

a question about check box

Scheduled Pinned Locked Moved C / C++ / MFC
performancehelpquestion
7 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    Gerald Mercet
    wrote on last edited by
    #1

    I have a dlg application in which i would like to put 2 check box. For each check box there is a boolean variable, i would like to use those variables so that my app could call the right function when one of this check box is flagged. But, when i try to compile my code i have this kind of warning message: warning c4800:"int":forcing value to bool "true" or "false"(performance warning) So, i don't know if it's really a big pb. Perhaps i should use another type of button as a radio button, i don't know! Thanks in advance for your help. gerald

    M D M 3 Replies Last reply
    0
    • G Gerald Mercet

      I have a dlg application in which i would like to put 2 check box. For each check box there is a boolean variable, i would like to use those variables so that my app could call the right function when one of this check box is flagged. But, when i try to compile my code i have this kind of warning message: warning c4800:"int":forcing value to bool "true" or "false"(performance warning) So, i don't know if it's really a big pb. Perhaps i should use another type of button as a radio button, i don't know! Thanks in advance for your help. gerald

      M Offline
      M Offline
      markkuk
      wrote on last edited by
      #2

      You can safely ignore this warning, or you can get rid of it by changing the type of variables from bool to int.

      1 Reply Last reply
      0
      • G Gerald Mercet

        I have a dlg application in which i would like to put 2 check box. For each check box there is a boolean variable, i would like to use those variables so that my app could call the right function when one of this check box is flagged. But, when i try to compile my code i have this kind of warning message: warning c4800:"int":forcing value to bool "true" or "false"(performance warning) So, i don't know if it's really a big pb. Perhaps i should use another type of button as a radio button, i don't know! Thanks in advance for your help. gerald

        D Offline
        D Offline
        Daniel Turini
        wrote on last edited by
        #3

        Please, post a code excerpt that raises the warning. Probably, you're doing something like this: int b; b = true; and you should be doing this: bool b; b = true; Tip: press now the reset button to test your memory.

        G 1 Reply Last reply
        0
        • D Daniel Turini

          Please, post a code excerpt that raises the warning. Probably, you're doing something like this: int b; b = true; and you should be doing this: bool b; b = true; Tip: press now the reset button to test your memory.

          G Offline
          G Offline
          Gerald Mercet
          wrote on last edited by
          #4

          first i post the function which use it: double EuropeanSwaption::CallOrPutEuropeanSwaption(COleDateTime StartDate,COleDateTime SwaptionEndDate,COleDateTime SwapEndDate,double Strike,int BaseAnnuelle,double Nominal,int Periodicity,_variant_t RateTable,_variant_t VolatilitySurface,bool CheckPayeuse,bool CheckReceveuse) { double Price; if(CheckPayeuse==TRUE && CheckReceveuse==FALSE) Price=CallEuropeanSwaption( StartDate, SwaptionEndDate,SwapEndDate,Strike,BaseAnnuelle,Nominal,Periodicity,RateTable,VolatilitySurface); if(CheckPayeuse==FALSE && CheckReceveuse==TRUE) Price=PutEuropeanSwaption( StartDate, SwaptionEndDate,SwapEndDate,Strike,BaseAnnuelle,Nominal,Periodicity,RateTable,VolatilitySurface); if(CheckPayeuse==TRUE && CheckReceveuse==TRUE||CheckPayeuse==FALSE && CheckReceveuse==FALSE) AfxMessageBox("Il faudrait peut être faire un choix!!"); return Price; } this first function is used in the calculation part. Now i could show a sample coming from the the dlg code, i just post the line which call the function described above: m_dlgPrice=eur.CallOrPutEuropeanSwaption(m_dlgStartDate,m_dlgSwaptionEndDate,m_dlgSwapEndDate,m_dlgStrike,m_dlgModeDate,m_dlgNominal,Periodicity,"TauxZCEURO","SurfaceVolatilite",m_dlgPayeuse,m_dlgReceveuse); where eur is an EuropeanSwaption object, and m_dlgPayeuse, m_dlgReceveuse are the 2 variables linked to the 2 check box put in the dlgbox.

          D 1 Reply Last reply
          0
          • G Gerald Mercet

            first i post the function which use it: double EuropeanSwaption::CallOrPutEuropeanSwaption(COleDateTime StartDate,COleDateTime SwaptionEndDate,COleDateTime SwapEndDate,double Strike,int BaseAnnuelle,double Nominal,int Periodicity,_variant_t RateTable,_variant_t VolatilitySurface,bool CheckPayeuse,bool CheckReceveuse) { double Price; if(CheckPayeuse==TRUE && CheckReceveuse==FALSE) Price=CallEuropeanSwaption( StartDate, SwaptionEndDate,SwapEndDate,Strike,BaseAnnuelle,Nominal,Periodicity,RateTable,VolatilitySurface); if(CheckPayeuse==FALSE && CheckReceveuse==TRUE) Price=PutEuropeanSwaption( StartDate, SwaptionEndDate,SwapEndDate,Strike,BaseAnnuelle,Nominal,Periodicity,RateTable,VolatilitySurface); if(CheckPayeuse==TRUE && CheckReceveuse==TRUE||CheckPayeuse==FALSE && CheckReceveuse==FALSE) AfxMessageBox("Il faudrait peut être faire un choix!!"); return Price; } this first function is used in the calculation part. Now i could show a sample coming from the the dlg code, i just post the line which call the function described above: m_dlgPrice=eur.CallOrPutEuropeanSwaption(m_dlgStartDate,m_dlgSwaptionEndDate,m_dlgSwapEndDate,m_dlgStrike,m_dlgModeDate,m_dlgNominal,Periodicity,"TauxZCEURO","SurfaceVolatilite",m_dlgPayeuse,m_dlgReceveuse); where eur is an EuropeanSwaption object, and m_dlgPayeuse, m_dlgReceveuse are the 2 variables linked to the 2 check box put in the dlgbox.

            D Offline
            D Offline
            Daniel Turini
            wrote on last edited by
            #5

            This is a common error: TRUE and FALSE are for type BOOL true and false are for type bool Try making them consistent and the warning will go away. Furor fit laesa saepius patientia

            G 1 Reply Last reply
            0
            • D Daniel Turini

              This is a common error: TRUE and FALSE are for type BOOL true and false are for type bool Try making them consistent and the warning will go away. Furor fit laesa saepius patientia

              G Offline
              G Offline
              Gerald Mercet
              wrote on last edited by
              #6

              i test it and it works, thanks a lot

              1 Reply Last reply
              0
              • G Gerald Mercet

                I have a dlg application in which i would like to put 2 check box. For each check box there is a boolean variable, i would like to use those variables so that my app could call the right function when one of this check box is flagged. But, when i try to compile my code i have this kind of warning message: warning c4800:"int":forcing value to bool "true" or "false"(performance warning) So, i don't know if it's really a big pb. Perhaps i should use another type of button as a radio button, i don't know! Thanks in advance for your help. gerald

                M Offline
                M Offline
                Mark Terrano
                wrote on last edited by
                #7

                Try using BOOL instead of bool for your variable. --Mark Terrano www.ensemblestudios.com (Creators of the Age of Empires series)

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups