Mailing List Archive


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

Re: [tlug] compilation warnings for unsigned char



>>>>> "Jim" == Jim Breen <Jim.Breen@example.com> writes:

    Jim> ["Stephen J. Turnbull" (Re: [tlug] compilation warnings for
    Jim> unsigned char) writes:]

    >>> If you have no worries about anything but char, try
    >>> -Wno-conversion.

    Jim> I tried that - it made no difference.

So much for GCC documentation.

    >>> Good!  The libraries you're calling were compiled with the
    >>> default definition of char; their prototypes should not be
    >>> changed.  (I wonder how they manage this?  I don't see
    >>> anything obvious in <string.h>.)

    Jim> Hmmm. It says (in string.h):
    Jim> extern char *strcpy (char *__restrict __dest, __const char *__restrict __src)

    Jim> I assumed that __restrict was the problem.

Could be, but I wasn't able to trace __restrict back to its semantics.

    Jim> I have tried just the I_TRUST_CPP section in my .h file and
    Jim> it worked for strc* but I shudder to think of doing it for
    Jim> everything like sprintf, etc.

The only thing you don't want to do it for is functions like strcmp,
but you shouldn't be using them anyway.

    Jim> What a stupid mess. Why for Bog's sake does the signed-ness
    Jim> of char matter for things like strcat and strcpy anyway?
    Jim> Mutter, mutter.

Because C doesn't have a concept of unordered bytes, only tiny ints,
for which comparisons matter in general, even if they don't for your
application.  You have to choose ....

It ought to be possible to just turn those warnings off; maybe you
should ask on the gcc list (or it might even be a FAQ).


-- 
School of Systems and Information Engineering http://turnbull.sk.tsukuba.ac.jp
University of Tsukuba                    Tennodai 1-1-1 Tsukuba 305-8573 JAPAN
               Ask not how you can "do" free software business;
              ask what your business can "do for" free software.


Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links