Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 26 Apr 2008 17:47:54 -0700
From:      Marcel Moolenaar <xcllnt@mac.com>
To:        Max Laier <max@love2party.net>
Cc:        freebsd-hackers@freebsd.org, hackers@freebsd.org, Romuald Conty <romuald.conty@free.fr>, =?ISO-8859-1?Q?Romain_Tarti=E8re?= <romain@blogreen.org>
Subject:   Re: indent(1) support for gcc(1) 0b prefix
Message-ID:  <5E2E3A08-A12E-4AF6-893D-20A44AC205AF@mac.com>
In-Reply-To: <200804270201.53271.max@love2party.net>
References:  <20080426213557.GA88577@marvin.blogreen.org> <200804270201.53271.max@love2party.net>

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

On Apr 26, 2008, at 5:01 PM, Max Laier wrote:

> On Saturday 26 April 2008 23:35:57 Romain Tarti=E8re wrote:
>> Hello FreeBSD hackers!
>>
>> I'm using avr-gcc from the ports and relying on the 0b prefix =20
>> notation
>> for binary constants, that is:
>>
>> 	foo =3D 0b00101010;
>>
>> Thanks to /usr/ports/devel/avr-gcc/files/patch-0b-constants this is
>> possible :-)
>>
>> But I would like to use indent(1) to reformat contributed code
>> automatically. Unfortunately, the 0b notation is not supported by =20
>> that
>> program, and the resulting code looks like this:
>>
>> 	foo =3D 0 b00101010;
>>
>> ... then compilation fails, bla bla bla...
>
> I can't think of a case (outside of "0x...." context) where "...0b..."
> would be valid C code, let alone better formated as "...0 b...".  =20
> Hence I
> see no harm in adding your patch to the base indent(1).
>
> Does anyone have an example where "...0 b..." is valid C code?

Well, if b... is a preprocessor define then you can easily
come up with valid C:

#define b...	*2

then:		...0 b...
becomes:	...0 *2

That's a valid expression in the right context...

FYI,

--=20
Marcel Moolenaar
xcllnt@mac.com





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?5E2E3A08-A12E-4AF6-893D-20A44AC205AF>