[comp.lang.c] default case

ts@cup.portal.com (Tim W Smith) (12/31/89)

Is it too late to make suggestions for ANSI C?  I'd like to see
the following added to C:

	The keyword "case" can be followed by the keyword
	"default" to indicate the default case.  This is
	in addition to the current method of just saying
	"default".

The reason I want this is because it makes it possible for the
compiler to notice when you misspell "default".  I has a switch
statement and I used "defualt" for the default case, and the
compiler correctly took this as a label.  It took quite a while
to track this down.

Note that this would not break any existing code.

						Tim Smith

henry@utzoo.uucp (Henry Spencer) (01/01/90)

In article <25516@cup.portal.com> ts@cup.portal.com (Tim W Smith) writes:
>Is it too late to make suggestions for ANSI C?  ...

Very.
-- 
1972: Saturn V #15 flight-ready|     Henry Spencer at U of Toronto Zoology
1989: birds nesting in engines | uunet!attcan!utzoo!henry henry@zoo.toronto.edu

ado@elsie.UUCP (Arthur David Olson) (01/02/90)

> The reason I want this is because it makes it possible for the
> compiler to notice when you misspell "default".

Script started on Mon Jan  1 15:25:00 1990
elsie$ cat try.c
int
main()
{
	switch (atoi("5")) {
		case 0:
			abort();
		defualt:
			break;
	}
	return 0;
}
elsie$ lint try.c
try.c:
try.c(7): warning: defualt unused in function main
elsie$ exit
script done on Mon Jan  1 15:25:16 1990
-- 
		1972:  Canada has no Saturn V equivalent
		1989:  Canada has no Saturn V equivalent
	Arthur David Olson   ado@alw.nih.gov   ADO is a trademark of Ampex.

friedl@mtndew.UUCP (Steve Friedl) (01/03/90)

In article <25516@cup.portal.com> ts@cup.portal.com (Tim W Smith) writes:
> Is it too late to make suggestions for ANSI C?  ...

and Henry Spencer replies
> Very.

Even if you have a good lawyer?

     Steve :-)

-- 
Stephen J. Friedl, KA8CMY   /  Consultant   /   Tustin, CA  /  3B2-kind-of-guy
714 544 6561 voice /  714 544 6496 fax  / uunet!mtndew!friedl / friedl@vsi.com

"PostScript wizard in training." - me