Date: Fri, 02 May 2008 05:11:57 +0300 From: Giorgos Keramidas <keramida@ceid.upatras.gr> To: Max Laier <max@love2party.net> Cc: freebsd-hackers@freebsd.org, hackers@freebsd.org, Romuald Conty <romuald.conty@free.fr>, Romain =?cp851?Q?Tarti=8Are?= <romain@blogreen.org> Subject: Re: indent(1) support for gcc(1) 0b prefix Message-ID: <8763txlaj6.fsf@kobe.laptop> In-Reply-To: <200804270201.53271.max@love2party.net> (Max Laier's message of "Sun, 27 Apr 2008 02:01:53 %2B0200") References: <20080426213557.GA88577@marvin.blogreen.org> <200804270201.53271.max@love2party.net>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, 27 Apr 2008 02:01:53 +0200, Max Laier <max@love2party.net> wrote:
> On Saturday 26 April 2008 23:35:57 Romain TartiŠre wrote:
>> Hello FreeBSD hackers!
>>
>> I'm using avr-gcc from the ports and relying on the 0b prefix notation
>> for binary constants, that is:
>>
>> foo = 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 that
>> program, and the resulting code looks like this:
>>
>> foo = 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...".
> 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?
The only case I can think of is when the "b..." is an existing macro,
i.e. something like:
1 #include <stdio.h>
2
3 #define b0101 + 3
4
5 int
6 main(void)
7 {
8 printf("%u\n", 0 b0101);
9 return 0;
10 }
But that's a rather contrived example. Making the "0b...." support
tunable through a command-line option seems ok for me.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?8763txlaj6.fsf>
