Skip to main content
added 74 characters in body
Source Link
blabb
  • 16.7k
  • 1
  • 15
  • 30

replaced the image with a gif that does a "show and show" show

enter image description hereenter image description here

enter image description here

replaced the image with a gif that does a "show and show" show

enter image description here

added 295 characters in body
Source Link
blabb
  • 16.7k
  • 1
  • 15
  • 30

if you want to disable optimization for specific functions only and not wholesale with /Od you can use #pragmas see the screen shot below which shows vscode / vsdevcmdprompt / compilation all in one

enter image description here

if you want to disable optimization for specific functions only and not wholesale with /Od you can use #pragmas see the screen shot below which shows vscode / vsdevcmdprompt / compilation all in one

enter image description here

added 487 characters in body
Source Link
blabb
  • 16.7k
  • 1
  • 15
  • 30

you may either need to use the local variables or compile with optimisations disasbleoptimizations disabled

I assume you are using msvc on windows ?? shown below is a snippet that was compiled on x64 for x64 in win 10 where you can clearlu seetheclearly see the local vars being initialized and used

F:\src\local>ff:\git\usr\bin\ls -lg
total 1
-rw-r--r-- 1 197121 61 Sep 25 15:24 local.cpp

F:\src\local>ff:\git\usr\bin\cat *
int main (void)
{
        int x = 1;
        int y = 2;
        return x+y;
}
F:\src\local>clcl /Zi /W4 -GS /analyze /Od /nologo local.cpp /link /release /ENTRY:main /SUBSYSTEM:windows /FIXED
local.cpp
 

F:\src\local>ff:\git\usr\bin\ls -lg *.exe
-rwxr-xr-x 1 197121 2560 Sep 25 15:32 local.exe

description of options given to compiler and linker

/Zi = build with debug info embedded in pdbfile 
/w4 build with highest possible warning level
-GS disable stack cookie
/analyze run code analysis on the src files 
/Od disable optimization
/entry:main (no crt libs are sued so you need to set the entry point
/subsystem:windows  no cmd or no crt or no input output this is not a console app 
so you need to specify which subsystem will this program work on
/fixed disable relocations

you may either need to use the local variables or compile with optimisations disasble

I assume you are using msvc on windows ?? shown below is a snippet that was compiled on x64 for x64 in win 10 where you can clearlu seethe local vars being initialized and used

F:\src\local>f:\git\usr\bin\ls -lg
total 1
-rw-r--r-- 1 197121 61 Sep 25 15:24 local.cpp

F:\src\local>f:\git\usr\bin\cat *
int main (void)
{
        int x = 1;
        int y = 2;
        return x+y;
}
F:\src\local>cl /Zi /W4 -GS /analyze /Od /nologo local.cpp /link /release /ENTRY:main /SUBSYSTEM:windows /FIXED
local.cpp
 

F:\src\local>f:\git\usr\bin\ls -lg *.exe
-rwxr-xr-x 1 197121 2560 Sep 25 15:32 local.exe

you may either need to use the local variables or compile with optimizations disabled

I assume you are using msvc on windows ?? shown below is a snippet that was compiled on x64 for x64 in win 10 where you can clearly see the local vars being initialized and used

f:\git\usr\bin\ls -lg
total 1
-rw-r--r-- 1 197121 61 Sep 25 15:24 local.cpp

f:\git\usr\bin\cat *
int main (void)
{
        int x = 1;
        int y = 2;
        return x+y;
}
cl /Zi /W4 -GS /analyze /Od /nologo local.cpp /link /release /ENTRY:main /SUBSYSTEM:windows /FIXED
local.cpp

f:\git\usr\bin\ls -lg *.exe
-rwxr-xr-x 1 197121 2560 Sep 25 15:32 local.exe

description of options given to compiler and linker

/Zi = build with debug info embedded in pdbfile 
/w4 build with highest possible warning level
-GS disable stack cookie
/analyze run code analysis on the src files 
/Od disable optimization
/entry:main (no crt libs are sued so you need to set the entry point
/subsystem:windows  no cmd or no crt or no input output this is not a console app 
so you need to specify which subsystem will this program work on
/fixed disable relocations
Source Link
blabb
  • 16.7k
  • 1
  • 15
  • 30
Loading