NO

Author Topic: CHAR - UNSIGNED CHAR Problem  (Read 9256 times)

Offline Robert

  • Member
  • *
  • Posts: 247
Re: CHAR - UNSIGNED CHAR Problem
« Reply #15 on: September 29, 2012, 08:08:17 AM »
There is a real problem with v 7.0.
Code: [Select]
#include <stdio.h>

void test1(char a, char b)
{
if ((unsigned char)b >= (unsigned char)a) puts("unsigned char");
else puts("signed char");
}

#pragma optimize(none)
void test2(char a, char b)
{
if ((unsigned char)b >= (unsigned char)a) puts("unsigned char");
else puts("signed char");
}
#pragma optimize()

int main(int argc, char **argv)
{
char a = 122, b = 166;
test1(a, b);
test2(a, b);
return 0;
}
returns
signed char
unsigned char

This problem has not been fixed in Version 7.0r.

Robert Wishlaw