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. had enough of C

had enough of C

Scheduled Pinned Locked Moved C / C++ / MFC
helpdebuggingperformancequestionannouncement
8 Posts 5 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.
  • P Offline
    P Offline
    Peter Liddle
    wrote on last edited by
    #1

    Grr Ive just about had enough of Visual B*$£%y studio. Okay heres my problem ive written a program that runs buetifully in Debug and i mean buetifully not a single error when runnign it 100's of times etc. Soon as i switch to release i get it just crashing or errors popping up saying some function failed. Okay one of teh biggest ones is CryptAcquireContext() fails with invalid parameter well hwo the hell can that be when the parameter is valid in debug. All i can think of is something is screwing up the memory where this is loaded has anyone got any ideas. Peter P.S Surely if something was screwing this memory area up it would be picked up in debud as an Assert failure?

    M C M 3 Replies Last reply
    0
    • P Peter Liddle

      Grr Ive just about had enough of Visual B*$£%y studio. Okay heres my problem ive written a program that runs buetifully in Debug and i mean buetifully not a single error when runnign it 100's of times etc. Soon as i switch to release i get it just crashing or errors popping up saying some function failed. Okay one of teh biggest ones is CryptAcquireContext() fails with invalid parameter well hwo the hell can that be when the parameter is valid in debug. All i can think of is something is screwing up the memory where this is loaded has anyone got any ideas. Peter P.S Surely if something was screwing this memory area up it would be picked up in debud as an Assert failure?

      M Offline
      M Offline
      Michael Dunn
      wrote on last edited by
      #2

      Peter Liddle wrote: well hwo the hell can that be when the parameter is valid in debug. Two words: uninitialized variables Check out John Newcomer's article here at CP about debug vs. release problems. --Mike-- Buy me stuff! (Link fixed now) Like the Google toolbar? Then check out UltraBar, with more features & customizable search engines! My really out-of-date homepage Big fan of Alyson Hannigan and Jamie Salé. Sonork - 100.10414 AcidHelm

      1 Reply Last reply
      0
      • P Peter Liddle

        Grr Ive just about had enough of Visual B*$£%y studio. Okay heres my problem ive written a program that runs buetifully in Debug and i mean buetifully not a single error when runnign it 100's of times etc. Soon as i switch to release i get it just crashing or errors popping up saying some function failed. Okay one of teh biggest ones is CryptAcquireContext() fails with invalid parameter well hwo the hell can that be when the parameter is valid in debug. All i can think of is something is screwing up the memory where this is loaded has anyone got any ideas. Peter P.S Surely if something was screwing this memory area up it would be picked up in debud as an Assert failure?

        C Offline
        C Offline
        Chris Losinger
        wrote on last edited by
        #3

        set your compiler's warning level to 4. this will catch a lot of stuff. (project / settings / C/C++ ) -c


        There ain't no second chance Against the thing with the forty eyes

        Smaller Animals Software

        1 Reply Last reply
        0
        • P Peter Liddle

          Grr Ive just about had enough of Visual B*$£%y studio. Okay heres my problem ive written a program that runs buetifully in Debug and i mean buetifully not a single error when runnign it 100's of times etc. Soon as i switch to release i get it just crashing or errors popping up saying some function failed. Okay one of teh biggest ones is CryptAcquireContext() fails with invalid parameter well hwo the hell can that be when the parameter is valid in debug. All i can think of is something is screwing up the memory where this is loaded has anyone got any ideas. Peter P.S Surely if something was screwing this memory area up it would be picked up in debud as an Assert failure?

          M Offline
          M Offline
          Max Santos
          wrote on last edited by
          #4

          you must also call "ZeroMemory" when passing some structs to API,if you do not call this the struct may have invalid data. Casa.Sapo.pt

          P 1 Reply Last reply
          0
          • M Max Santos

            you must also call "ZeroMemory" when passing some structs to API,if you do not call this the struct may have invalid data. Casa.Sapo.pt

            P Offline
            P Offline
            Peter Liddle
            wrote on last edited by
            #5

            Thats what i thought that it would be unintalised variables but i have checked loads of times and can't find any and no warnign about them are bought up. Maximaiano whats that about zeromemory i have zeroed all my structs when i initalise them shoudl i be zeroing them somewhere else as well? Peter

            L 2 Replies Last reply
            0
            • P Peter Liddle

              Thats what i thought that it would be unintalised variables but i have checked loads of times and can't find any and no warnign about them are bought up. Maximaiano whats that about zeromemory i have zeroed all my structs when i initalise them shoudl i be zeroing them somewhere else as well? Peter

              L Offline
              L Offline
              Lost User
              wrote on last edited by
              #6

              look at this sample... in this sample i am changing the text of one header item (CHeaderCtrl) HDITEM hdi; ZeroMemory(&hdi, sizeof(hdi)); //if i do not call this it will crash in release (most of the times) hdi.mask = HDI_TEXT | HDI_FORMAT; hdi.fmt = HDF_STRING | HDF_CENTER; hdi.pszText = "Cool String"; m_Header.SetItem(i,&hdi); why does it crash? when we call SetItem we are passing all the items in the struct (hdi) not only the ones that we use (hdi.mask,hdi.fmt,hdi.pszText) and because the the items that we didnt use may have invalid data the control crashes the zeromemory "cleans" the struct , providing a safe way of sending a struct to a control without invalid data. Casa.Sapo.pt

              1 Reply Last reply
              0
              • P Peter Liddle

                Thats what i thought that it would be unintalised variables but i have checked loads of times and can't find any and no warnign about them are bought up. Maximaiano whats that about zeromemory i have zeroed all my structs when i initalise them shoudl i be zeroing them somewhere else as well? Peter

                L Offline
                L Offline
                Lost User
                wrote on last edited by
                #7

                why is this Anonymous ????????????????????:confused: :confused: :confused: Casa.Sapo.pt

                L 1 Reply Last reply
                0
                • L Lost User

                  why is this Anonymous ????????????????????:confused: :confused: :confused: Casa.Sapo.pt

                  L Offline
                  L Offline
                  Lost User
                  wrote on last edited by
                  #8

                  a Casa.Sapo.pt

                  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