This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] gcc/c-family/c-cppbuiltin.c: Use 20 instead of 18 for the maximized 64-bits integer decimal string length
- From: Joseph Myers <joseph at codesourcery dot com>
- To: Chen Gang <gang dot chen dot 5i5j at gmail dot com>
- Cc: <rth at redhat dot com>, Jeff Law <law at redhat dot com>, gcc-patches List <gcc-patches at gcc dot gnu dot org>
- Date: Thu, 20 Nov 2014 22:34:00 +0000
- Subject: Re: [PATCH] gcc/c-family/c-cppbuiltin.c: Use 20 instead of 18 for the maximized 64-bits integer decimal string length
- Authentication-results: sourceware.org; auth=none
- References: <5468B4F5 dot 9020600 at gmail dot com> <alpine dot DEB dot 2 dot 10 dot 1411181639020 dot 11642 at digraph dot polyomino dot org dot uk> <546C088D dot 6060302 at gmail dot com> <alpine dot DEB dot 2 dot 10 dot 1411191717230 dot 28145 at digraph dot polyomino dot org dot uk> <546D5433 dot 7010109 at gmail dot com>
On Thu, 20 Nov 2014, Chen Gang wrote:
> OK, thanks. I guess your meaning is:
>
> - If the value is small enough to be expressed by type 'int', we should
> not provide 'LL'.
Yes - and values not small enough should probably not be accepted by this
function.
> - If the value is positive number, we should not provide '(' and ')'.
Yes.
> > Really I think it
> > would be better to require that this function is only used for values that
> > fit in target int (given appropriate checks on all the users to make sure
> > they fit in with that), and put a corresponding assertion there.
> >
>
> Excuse me, I am not quite familiar with "target int", could you provide
> more details for it? And if necessary, please help send patch v2 instead
> of me:
"target int" is the type int on the target, as opposed to on the host
(with precision TYPE_PRECISION (integer_type_node)). I think you can use
wi::fits_to_tree_p (n, integer_type_node) to test if n is in range for
target int.
--
Joseph S. Myers
joseph@codesourcery.com