NO

Author Topic: unreachable code with 'maximize speed'  (Read 2245 times)

JohnF

  • Guest
unreachable code with 'maximize speed'
« on: July 21, 2012, 11:36:21 AM »
The following code is fine with optimized speed if "BM" is a string but will not do as a literal.

Code: [Select]
#include <stdio.h>

int main(void)
{
short bfType = 0x4D42;

if ((bfType == *(short *)"BM"))
{
printf("OK\n"); // unreachable code with 'maximize speed'
}
else
{
printf("Not OK\n");
}

return 0;
}

John

Offline Pelle

  • Administrator
  • Member
  • *****
  • Posts: 2266
    • http://www.smorgasbordet.com
Re: unreachable code with 'maximize speed'
« Reply #1 on: September 01, 2012, 08:22:55 PM »
Questionably code, at least. I will see what I can do...
/Pelle