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. not init vars to zero?

not init vars to zero?

Scheduled Pinned Locked Moved C / C++ / MFC
c++debuggingquestion
3 Posts 3 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.
  • N Offline
    N Offline
    nm_114
    wrote on last edited by
    #1

    Is there any option to not have the compiler initialize variables to zero in debug builds? (I'm using VC++ 6) - thanks

    S S 2 Replies Last reply
    0
    • N nm_114

      Is there any option to not have the compiler initialize variables to zero in debug builds? (I'm using VC++ 6) - thanks

      S Offline
      S Offline
      Sarath C
      wrote on last edited by
      #2

      as off now my information is the compiler initialize the variabe with a valueu 0xcccccccc in debug build. SaRath.
      "Don't Do Different things... Do Things Differently..."

      1 Reply Last reply
      0
      • N nm_114

        Is there any option to not have the compiler initialize variables to zero in debug builds? (I'm using VC++ 6) - thanks

        S Offline
        S Offline
        Stephen Hewitt
        wrote on last edited by
        #3

        Global variables are always zero initialised. As someone else mentioned, local variables are initialised to 0xCCCCCCCC in debug builds but left as is in release builds. Look into the /GZ compiler switch. Removing it stops locals from being initialised with 0xCCCCCCCC. I use MSVC6 so you might want to check that nothing has changes if you use a later version. Steve

        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