Re: GCC 3.3.1, new warnings with <limits>

From: Terry Lambert <tlambert2_at_mindspring.com>
Date: Tue, 15 Jul 2003 03:59:30 -0700
David Leimbach wrote:
> >Gcc needs a #pragma to disable specific warnings as a one-shot.
> >
> >This was discussed in detail on the GCC mailing list.
> 
> True... but I don't think I was talking about a one-shot disabling
> of the message.
> 
> I was thinking more about how a compliant C++ compiler can determine
> the signedness of a datatype without type introspection or type
> metadata available at compile time.  [which seems to be what
> numeric_limits<T> is all about doesn't it?]

I don't think there's a good answer available that's also
portable.  What you need is an implementation that doesn't
care about the signedness of the type.

You could do some really ugly tricks that would work.  For
example, calling a helper function with the same argument
twice, and setting one of the arguments to zero, and using
*that* to do the compare (the types would always match).
using two compares swapping the values would tell you what
you needed.  You'd probably want to mark the helper private,
or at least protected, and call it something like "_docompare"
to put it in the implementation space.

As I said... really ugly tricks.  8-).

-- Terry
Received on Tue Jul 15 2003 - 02:02:40 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:37:15 UTC