From owner-freebsd-hackers@FreeBSD.ORG Fri May 2 04:57:49 2008 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D1E11106566B for ; Fri, 2 May 2008 04:57:49 +0000 (UTC) (envelope-from kientzle@freebsd.org) Received: from kientzle.com (h-66-166-149-50.snvacaid.covad.net [66.166.149.50]) by mx1.freebsd.org (Postfix) with ESMTP id 44FEA8FC1C for ; Fri, 2 May 2008 04:57:48 +0000 (UTC) (envelope-from kientzle@freebsd.org) Received: from [10.0.0.128] (p54.kientzle.com [66.166.149.54]) by kientzle.com (8.12.9/8.12.9) with ESMTP id m424GStv010691; Thu, 1 May 2008 21:16:28 -0700 (PDT) (envelope-from kientzle@freebsd.org) Message-ID: <481A959C.5000704@freebsd.org> Date: Thu, 01 May 2008 21:16:28 -0700 From: Tim Kientzle User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.7.12) Gecko/20060422 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Giorgos Keramidas References: <20080426213557.GA88577@marvin.blogreen.org> <200804270201.53271.max@love2party.net> <8763txlaj6.fsf@kobe.laptop> In-Reply-To: <8763txlaj6.fsf@kobe.laptop> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Cc: =?UTF-8?B?Um9tYWluIO+/vQ==?= , Max Laier , hackers@freebsd.org, Romuald Conty , freebsd-hackers@freebsd.org Subject: Re: indent(1) support for gcc(1) 0b prefix X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 May 2008 04:57:49 -0000 >>>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 > 2 > 3 #define b0101 + 3 In all of these cases, though, adding a space between the '0' and the 'b' changes the meaning, so is wrong. Indent can change/insert whitespace, but should never do so in a way that changes the meaning of the program. In all of these cases, having indent recognize "0b..." as a single token is the correct behavior. So I don't see any point in having this recognition be tunable. indent already has too many switches. Tim Kientzle