From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16434 invoked by alias); 6 Aug 2002 01:39:15 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 16338 invoked from network); 6 Aug 2002 01:39:15 -0000 Received: from unknown (HELO cygnus.com) (205.180.83.203) by sources.redhat.com with SMTP; 6 Aug 2002 01:39:15 -0000 Received: from redhat.com (reddwarf.sfbay.redhat.com [172.16.24.50]) by runyon.cygnus.com (8.8.7-cygnus/8.8.7) with ESMTP id SAA07430; Mon, 5 Aug 2002 18:37:34 -0700 (PDT) Message-ID: <3D4F245F.6EAF1073@redhat.com> Date: Mon, 05 Aug 2002 18:39:00 -0000 From: Michael Snyder Organization: Red Hat, Inc. X-Accept-Language: en MIME-Version: 1.0 To: Daniel Jacobowitz CC: Joel Brobecker , gdb-patches@sources.redhat.com Subject: Re: Question regarding bizarre ',' References: <20020806012134.GC916@gnat.com> <20020806012702.GA15122@nevyn.them.org> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-SW-Source: 2002-08/txt/msg00107.txt.bz2 Daniel Jacobowitz wrote: > > On Mon, Aug 05, 2002 at 06:21:35PM -0700, Joel Brobecker wrote: > > This is where I show my lack of C-knowledge: > > > > in i386v4-nat.c, I read the following code: > > > > /* Mapping between the general-purpose registers in `/proc' > > format and GDB's register array layout. */ > > static int regmap[] = > > { > > EAX, ECX, EDX, EBX, > > UESP, EBP, ESI, EDI, > > EIP, EFL, CS, SS, > > DS, ES, FS, GS, > > }; > > > > I would have thought that the last ',' would cause a compilation error. > > But this seems to compile fine. Any reason for keeping this last comma? > > It makes it easier to add an element without having to touch any > existing line, to make diffs clearer. A trailing comma in an array > initializer (or struct initializer maybe?) is ignored. By most compilers, but some (possibly deviant ones) will give you an error, or at least a warning. I have definitely encountered this when building GDB, and I think most array and enum initializers in gdb do not have the trailing comma for this reason. Michael