Jump to content
  • 0

vstudio 2005 optimize small things?


Naelson

Question

i have this code set up on vsd 2005, thefore i cannot find it into IDA  the function sum, second people answer my ask in previous community, this was optimize by compiler. can there is any config for it, to don't optimize samples things?

 

#include <iostream>
extern "C" {
    int sum(unsigned char s1 = 10, int s3 = 25) {
    s3 = s1 * (s3);
 }
}

int main() {
    int y = 50;
    int x = 50;
    return 0;
}
  

 


ENCONTREI ESTE Start 
 
_int64 start()
{
  unk_407610 = 0;
  sub_401660();
  return sub_401180();
}
 
ENCONTREI ESTE MAIN
 
.text:0000000000402C10 ; int __cdecl main(int argc, const char **argv, const char **envp)
.text:0000000000402C10 main            proc near               ; CODE XREF: sub_401180+242p
.text:0000000000402C10                                         ; DATA XREF: .pdata:0000000000405258o ...
.text:0000000000402C10                 sub     rsp, 28h
.text:0000000000402C14                 call    sub_401620
.text:0000000000402C19                 xor     eax, eax
.text:0000000000402C1B                 add     rsp, 28h
.text:0000000000402C1F                 retn
.text:0000000000402C1F main            endp
.text:0000000000402C1F
 
 
.text:0000000000401620 sub_401620      proc near               ; CODE XREF: sub_401180+215p
.text:0000000000401620                                         ; main+4p
.text:0000000000401620                 mov     eax, cs:dword_407040
.text:0000000000401626                 test    eax, eax
.text:0000000000401628                 jz      short loc_401630
.text:000000000040162A                 retn

 

 

only now i am see that sum not have a return, i even not know as it  have been compiled

Edited by Naelson
Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

you have 2 options to control compiler optimizations

 

using pragma directive, at the top of a file you don't want anything inside optimized

#pragma optimize("", off)

 

using project configuration

right click the project, properties -> configuration properties -> c/c++ -> optimization -> set optimization to disabled

 

though tbh i'm not sure it will ever not optimize instructions that have static values at compile time, never bothered trying

  • Upvote 1
Link to comment
Share on other sites

  • 0
On 1/13/2022 at 2:03 AM, Anarchy said:

you have 2 options to control compiler optimizations

 

using pragma directive, at the top of a file you don't want anything inside optimized

#pragma optimize("", off)

 

using project configuration

right click the project, properties -> configuration properties -> c/c++ -> optimization -> set optimization to disabled

 

though tbh i'm not sure it will ever not optimize instructions that have static values at compile time, never bothered trying

project, properties -> configuration properties -> c/c++ -> optimization -> set optimization to disabled 👊

 

 

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now


×
×
  • Create New...