🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #5476

Re: trailing comma inside enum...bug or feature?

#5476
From: Wonderly
Date: Thu, 08 Dec 1988 15:52
48 lines
1782 bytes
From article <9095@smoke.BRL.MIL>, by gwyn@smoke.BRL.MIL (Doug Gwyn ):
> In article <2174@vedge.UUCP> lai@vedge.UUCP (David Lai) writes:
>>Is this a bug or feature?
> 
> An unofficial feature.
> 
>>Should ANSI compilers allow this?
> 
> Definitely not!  Trailing comma in an initializer list is allowed, though.

At first sight it appears to not be necessary, however it does prove to
be a benefit in some software modification control environments that I
know about.  If the initial definition of an enum is say

typedef enum FOO {
	VALUE1,
	VALUE2,
} FOO_CONST;

and a modification changed it to

typedef enum FOO {
	VALUE1,
	VALUE2,
	VALUE3
} FOO_CONST;

and finally another modification changed it to

typedef enum FOO {
	VALUE1,
	VALUE2,
	VALUE3,
	VALUE4,
} FOO_CONST;

The modification control system that I know about would say that the
third modification is 'dependent' on the second in a physical way
because a line of code was changed.  Now obviously, the comma could
be placed on the line with VALUE4, but that is not the typical nor
desireable coding style.

By leaving the trailing comma there, future modifications are easily
made without additional changes and dependencies needed.

-- 
It isn't the DREAM that NASA's missing...  DOMAIN: gregg@ihlpb.att.com
It's a direction!                          UUCP:   att!ihlpb!gregg
Technical Details
Message-ID: <9167@ihlpb.ATT.COM>
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!lll-winken!lll-tis!ames!mailrus!ukma!rutgers!att!ihlpb!gregg
References: <9095@smoke.BRL.MIL>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!lll-winken!lll-tis!ames!mailrus!ukma!rutgers!att!ihlpb!gregg
From: gregg@ihlpb.ATT.COM (Wonderly)
Newsgroups: comp.std.c,comp.windows.x
Subject: Re: trailing comma inside enum...bug or feature?
Message-ID: <9167@ihlpb.ATT.COM>
Date: 8 Dec 88 15:52:42 GMT
References: <9095@smoke.BRL.MIL>
Organization: AT&T Bell Laboratories - Naperville, Illinois
Lines: 47