1

enter image description here

Just confused, why is not mL = 1?

Alice
  • 701
  • 1
  • 5
  • 17

1 Answers1

3

Visual studio treats int mL = 400/400 as two step process.

First step would be allocating memory in stack. So, you see a garbage value. Press F10/F11 (step once more) you should see 1.

-858993460 translates to 0xCCCCCCCC which is a bit pattern used by Microsoft compilers to detect buffer overruns and to initialize an empty stack.Some more details here - softwareverify.com/memory-bit-patterns.php

Benesh
  • 3,398
  • 1
  • 18
  • 38
Mohan
  • 1,850
  • 1
  • 19
  • 42
  • 1
    It is *not* a garbage value, -858993460 has a well defined meaning. That it appears more than once in the OP's screenshot is also not an accident. Convert it to hex to see that it is special. – Hans Passant Mar 22 '14 at 07:51
  • and this value often appears in debug mode. It helps debugging in many situations – phuclv Mar 22 '14 at 08:30
  • It is nothing special. It is 0xCCCCCCCC. This bit pattern is often used by MS compilers. I Couldn't find it officially in MFC or Win32 but I guess this could help - http://www.softwareverify.com/memory-bit-patterns.php – Mohan Mar 22 '14 at 08:41
  • [When and why will an OS initialise memory to 0xCD, 0xDD, etc. on malloc/free/new/delete?](https://stackoverflow.com/q/370195/995714) – phuclv Aug 18 '18 at 11:13