Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 13 Jul 2003 08:23:54 -0500
From:      David Leimbach <leimy2k@mac.com>
To:        Alexander Kabaev <kabaev@mail.ru>
Cc:        freebsd-current@freebsd.org
Subject:   Re: GCC 3.3.1, new warnings with <limits>
Message-ID:  <401FAE5E-B535-11D7-BE3B-0003937E39E0@mac.com>
In-Reply-To: <20030713000559.28c18be6.kabaev@mail.ru>
References:  <20030712155333.GA79322@crodrigues.org> <BEDC8C48-B4DC-11D7-BE3B-0003937E39E0@mac.com> <20030713031312.GA89014@crodrigues.org> <20030713000559.28c18be6.kabaev@mail.ru>

next in thread | previous in thread | raw e-mail | index | archive | help

On Saturday, July 12, 2003, at 11:05PM, Alexander Kabaev wrote:

> On Sat, 12 Jul 2003 23:13:12 -0400
> Craig Rodrigues <rodrigc@crodrigues.org> wrote:
>
>> I am guessing that the C preprocessor does not think that it is
>> in a system header, and thus prints out the warning.
>
> We specifically disable automatic warning suppression for system
> headers, because we _want_ to know about them. Your Linux distribution
> apparently does not care.
>

This is a good policy in general, however, one could easily argue that 
what
is trying to be determined with signedness  and such being 
less-than-compared
to 0 isn't really a big deal and possibly the only way to implement this
numeric_limits<T>::digits thing without any type introspection which 
C++ currently
lacks.

The following would work for example in a template function:

template <typname T>
void foo(T const & f)
{
	if (numeric_limits<T>::digits % 2)
		//type is signed
	else
		//type is unsigned
}

However to implement "digits" we have that nasty macro that makes the 
comparison
which is meaningless for unsigned types of "< 0".

This is probably a perfect example of where the C++ standards committee 
folks should
be queried about the best way to implement numeric_limits<T>::digits.  
Some of them
have had no trouble pointing out that C99's tgmath.h header cannot be 
implemented in
pure standard C99.  This may also be true of numeric_limits<T>::digits.

I am going to the newsgroups... My old college advisor is/was a 
moderator on
comp.lang.c++.moderated and he may "just know" the answer :).



>>
>> Any GCC/FreeBSD expert care to comment? ;)
>>
> Short of fixing offending files in FSF libstdc++ or turning warning
> suppression back on for standard C++ include files selectively, I have
> no suggestion.

I'd rather we fix the problem in gcc but this extra verbosity when 
there is nothing
wrong with user code also seems incorrect.  I think the gcc developers 
should have a
separate command line option for internal headers don't you?


>
> --
> Alexander Kabaev



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?401FAE5E-B535-11D7-BE3B-0003937E39E0>