X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-workers-bounces using -f From: Martin Str|mberg Message-Id: <200112251716.SAA11347@father.ludd.luth.se> Subject: Re: gcc 3.03 and libc sources In-Reply-To: from Eli Zaretskii at "Dec 25, 2001 01:31:51 pm" To: djgpp-workers AT delorie DOT com Date: Tue, 25 Dec 2001 18:16:39 +0100 (MET) X-Mailer: ELM [version 2.4ME+ PL54 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Reply-To: djgpp-workers AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp-workers AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk According to Eli Zaretskii: > > On Tue, 25 Dec 2001, Martin Str|mberg wrote: > > > - *decpt = dot ? dot - s : strlen (s); > > + *decpt = dot ? dot - s : (ssize_t)strlen (s); > > I don't understand why did you cast to ssize_t here. I'd say either cast > to int or to ptrdiff_t. The latter is more accurate, since "dot -s" is a > difference between two pointers; but because gcc wants a signed type, int > should be okay as well. I thought ssize_t is the signed counterpart of size_t and as strlen()'s return type is size_t I made that change. Now I see that ssize_t isn't standard but ptrdiff_t is, so I'll change that. > I still have no idea why does gcc complain here. What's wrong about > having an expression whose result could be either signed or unsigned? I > think it's worth a bug report nonetheless, if only to hear an > explanation from the maintainers. I'm using -Wsign-compare, which is the option that produces this warning. I assume this makes gcc complain about implicit casting. So if we have a "bool ? signed : unsigned" expression, one of signed or unsigned must be casted. Right, MartinS