problems/risks due to programming language
Peter da Silva
peter at ficc.uu.net
Tue Feb 27 02:28:35 AEST 1990
First of all, my point about gotos had nothing to do with your point
about gotos.
In article <8145 at hubcap.clemson.edu> billwolf%hazel.cs.clemson.edu at hubcap.clemson.edu writes:
> Many (including Peter) have re-observed that this is the way C's switch
> currently operates, but to date nobody has provided any justification for
> having it continue to operate that way.
I'm not going to bother continuing this discussion. The very article you were
referencing shows an example of how the C switch construct may be profitably
used. I can show you the working code I based that example on, if you like.
By all means make 'break' the default... but provide a convenient (not
involving explicit gotos) method of falling through to the next case.
The construct you seek has existed in C from the beginning:
#define CASE switch {
#define WHEN break; case
#define OR : case
#define DO :
#define OTHERWISE default:
#define ESAC }
CASE (language)
WHEN ADA OR COBOL DO
blame the DOD;
WHEN C OR FORTH DO
blame people who wanted to get
real work done instead of building
more beauracracy;
OTHERWISE
see appropriate ANSI standards;
ESAC
--
_--_|\ Peter da Silva. +1 713 274 5180. <peter at ficc.uu.net>.
/ \
\_.--._/ Xenix Support -- it's not just a job, it's an adventure!
v "Have you hugged your wolf today?" `-_-'
More information about the Comp.lang.c
mailing list