P
PLS
I'm amazed at the following generated code.
The environment is:
VS2005 SP1
Debug mode
Declarations
bool different;
fileVersion and MSGFILEVERSION are unsigned int
different = different || header.fileVersion != MSGFILEVERSION;
00672244 movzx eax,byte ptr [different]
0067224B test eax,eax
0067224D jne 00672264
0067224F cmp dword ptr [header],67h
00672256 jne 00672264
00672258 mov dword ptr [ebp-89Ch],0
00672262 jmp 0067226E
00672264 mov dword ptr [ebp-89Ch],1
0067226E mov ecx,dword ptr [ebp-89Ch]
00672274 call @ILT+11940(@_RTC_Check_4_to_1@4) (560EA9h)
00672279 mov byte ptr [different],al
The generated code developes a one byte bool value by storing into a 32
bit int temporary. The value can only be 0 or 1. It then goes through a
truncation check before storing the one byte value into a one byte
boolean variable. Awful.
++PLS
The environment is:
VS2005 SP1
Debug mode
Declarations
bool different;
fileVersion and MSGFILEVERSION are unsigned int
different = different || header.fileVersion != MSGFILEVERSION;
00672244 movzx eax,byte ptr [different]
0067224B test eax,eax
0067224D jne 00672264
0067224F cmp dword ptr [header],67h
00672256 jne 00672264
00672258 mov dword ptr [ebp-89Ch],0
00672262 jmp 0067226E
00672264 mov dword ptr [ebp-89Ch],1
0067226E mov ecx,dword ptr [ebp-89Ch]
00672274 call @ILT+11940(@_RTC_Check_4_to_1@4) (560EA9h)
00672279 mov byte ptr [different],al
The generated code developes a one byte bool value by storing into a 32
bit int temporary. The value can only be 0 or 1. It then goes through a
truncation check before storing the one byte value into a one byte
boolean variable. Awful.
++PLS