Mailing List Archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[tlug] gcc:0x81 out of range



Hello all,

Please refer to the code in the attachment.

I have compiled this function with Redhat Enterprise Linux 3, gcc
3.2.3.20 and it says:

trim.c:28: warning: comparison is always false due to limited range of data type
trim.c:38: warning: comparison is always false due to limited range of data type

I *thought* this code will get compiled and run in Windows with VC6 at
least, but with gcc 3.2.3, I got the warning ( as you can see ) : 0x81
is out of range.

If run properly, this code will trim UEC space but under my
environment, it does not.

Any idea?

--
Best Regards,
Nguyen Hung Vu
vuhung16plus{remove}@example.com
VIQR Standard: http://vi.i18n.kde.org/viqr.txt
				char *trim(char *lpszString )   // (in) ½èÍýÂоݤÎʸ»úÎó
{
        char    *ps;    // ¶õÇòʸ»ú¤ò½ü¤¤¤¿ÀèƬ
        char    *pe;    // ¶õÇòʸ»ú¤ò½ü¤¤¤¿ºÇ¸åÈø
        char    *p;             // ¥ï¡¼¥¯¥Ý¥¤¥ó¥¿
 
 
        // ÀèƬ¤ò¸«¤Ä¤±¤ë
        for ( ps = lpszString; *ps; ps++ ) {
                if ( ( 0x81 == *ps ) && ( 0x40 == *( ps + 1 ) ) ) {     // Á´³Ñ¥¹¥Ú¡¼¥¹
                        ps++;
                }
                else if  ( 0x20 < *ps ) {               // ¥Û¥ï¥¤¥È¥¹¥Ú¡¼¥¹°Ê³°¢ªÀèƬ
                        break;
                }
                }
 
        // ºÇ¸å¤ò¸«¤Ä¤±¤ë
        for ( p = pe = ps; *p; p++ ) {
                if ( ( 0x81 == *p ) && ( 0x40 == *( p + 1 ) ) ) {       // Á´³Ñ¥¹¥Ú¡¼¥¹
                        p++;
                }
                else if  ( 0x20 < *p ) {                // ¥Û¥ï¥¤¥È¥¹¥Ú¡¼¥¹°Ê³°¢ªºÇ¸åÈø?
                        pe = p;
                }
        }
 
        // ¥³¥Ô¡¼
        for ( p = lpszString; ps <= pe; ) {
                *p++ = *ps++;
        }
 
        *p = '\0';
        return lpszString;
}

gcc trim.c

trim.c:28: warning: comparison is always false due to limited range of data type
trim.c:38: warning: comparison is always false due to limited range of data type


Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links