[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Tinycc-devel] Basic patch for passing W9X short DOS paths to TCC.
From: |
lostgallifreyan |
Subject: |
Re: [Tinycc-devel] Basic patch for passing W9X short DOS paths to TCC. |
Date: |
Wed, 15 Apr 2009 06:37:33 +0100 |
Dave Dodge <address@hidden> wrote:
(14/04/2009 21:18)
>> Ok. Point taken about undefined behaviour. Is the "unsigned char *p"
>> declaration enough though?
>
>Yes. Dereferencing a valid (unsigned char *) will produce an
>(unsigned char), which by definition is safe to pass to isupper.
>
>> One mail suggested using "unsigned" at every subsequent use of the
>> variable.
>
>That's because p was a (char *), and therefore *p was producing a
>possibly-signed value. Casting the dereferenced value to (unsigned
>char) is another way of ensuring isupper gets a usable value, but I
>think simply changing p to an (unsigned char *) is cleaner.
>
So do I. Thankyou.
>BTW it's worth noting that casting from a signed integer to an
>unsigned integer is a well-defined operation, but casting from
>unsigned to signed is implementation-defined.
>
Sounds familiar. I think I read there were at least three standard ways to
encode negative numbers. Though I think one of them (Two's complement: up from
0 to total/2-1, and down from total until you reach total/2), where 'total' is
the full count of possible values available) strongly dominates the others.
Re: [Tinycc-devel] Basic patch for passing W9X short DOS paths to TCC., lostgallifreyan, 2009/04/14
- Re: [Tinycc-devel] Basic patch for passing W9X short DOS paths to TCC., Ivo, 2009/04/14
- Re: [Tinycc-devel] Basic patch for passing W9X short DOS paths to TCC., lostgallifreyan, 2009/04/14
- Re: [Tinycc-devel] Basic patch for passing W9X short DOS paths to TCC., lostgallifreyan, 2009/04/14
- Re: [Tinycc-devel] Basic patch for passing W9X short DOS paths to TCC., grischka, 2009/04/14
- Re: [Tinycc-devel] Basic patch for passing W9X short DOS paths to TCC., lostgallifreyan, 2009/04/14
- Re: [Tinycc-devel] Basic patch for passing W9X short DOS paths to TCC., grischka, 2009/04/14
- Re: [Tinycc-devel] Basic patch for passing W9X short DOS paths to TCC., lostgallifreyan, 2009/04/15
- Re: [Tinycc-devel] Basic patch for passing W9X short DOS paths to TCC., Joshua Phillips, 2009/04/15
- Re: [Tinycc-devel] Basic patch for passing W9X short DOS paths to TCC., lostgallifreyan, 2009/04/15