Date: Wed, 30 Apr 2008 12:48:55 +0200 From: Romain =?iso-8859-1?Q?Tarti=E8re?= <romain@blogreen.org> To: hackers@freebsd.org Subject: Re: indent(1) support for gcc(1) 0b prefix Message-ID: <20080430104855.GA26622@marvin.blogreen.org> In-Reply-To: <d438888b768227b724504378c8f77b8e@gmail.com> References: <20080426213557.GA88577@marvin.blogreen.org> <d438888b768227b724504378c8f77b8e@gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
[-- Attachment #1 --]
On Sun, Apr 27, 2008 at 03:38:54PM -0500, Joshua Isom wrote:
> The man page for indent does say "it has a 'forgiving' parser" so I
> don't see why it can't just treat any token starting with a zero as
> special, treat 0b01, 0x0A, 0f4 and 010 as a number regardless of the
> base, even if it doesn't know the base.
I think indent(1) has to check the base in order to split tokens
consistently. Consider the following statements:
read | write | description
--------------+---------------+-----------------------------
42 | 42 | Decimal
42e+3 | 42e+3 | Decimal
042 | 042 | Octal
042e+3 | 042e+3 | Octal?? gcc compiles this but the result
| | looks strange...
0x42 | 0x42 | Hexadecimal
0x42e+3 | 0x42e + 3 | Hexadecimal + Decimal
IMHO, checking numbers base is a requirement for splitting tokens
wisely.
Regards
--
Romain Tartière <romain@blogreen.org> http://romain.blogreen.org/
pgp: 8DAB A124 0DA4 7024 F82A E748 D8E9 A33F FF56 FF43 (ID: 0xFF56FF43)
(plain text =non-HTML= PGP/GPG encrypted/signed e-mail much appreciated)
[-- Attachment #2 --]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.9 (FreeBSD)
iEYEARECAAYFAkgYTpcACgkQ2OmjP/9W/0NuUwCfdrrXJXD1omAv7BdXrnGHhNfA
4L0AoI/mhXF2ZOajX2vTYhpPmF4GGk28
=zjZp
-----END PGP SIGNATURE-----
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20080430104855.GA26622>
