home *** CD-ROM | disk | FTP | other *** search
- Xref: sparky comp.lang.c++:16826 comp.std.c++:1615
- Newsgroups: comp.lang.c++,comp.std.c++
- Path: sparky!uunet!munnari.oz.au!sol.deakin.OZ.AU!news.cs.uow.edu.au!cssc-syd.tansu.com.au!pete
- From: pete@cssc-syd.tansu.com.au (Peter Alexander Merel)
- Subject: Re: Proposal - enhancement for switch statement.
- Message-ID: <1992Nov24.024600.26040@cssc-syd.tansu.com.au>
- Organization: AOTC - CSSC
- References: <1992Nov16.004558.9855@muddcs.claremont.edu> <1992Nov16.213015.1@vax1.bham.ac.uk> <1992Nov19.163944.19935@ucc.su.OZ.AU> <1992Nov20.195059.1@vax1.bham.ac.uk>
- Date: Tue, 24 Nov 1992 02:46:00 GMT
- Lines: 56
-
- mccauleyba@vax1.bham.ac.uk (Brian McCauley) writes:
-
- >In article <1992Nov19.163944.19935@ucc.su.OZ.AU>, maxtal@extro.ucc.su.OZ.AU (John MAX Skaller) writes:
- >[It's illegal]
- >Of course it's illegal!
- >What is being discussed is the merit of allowing the switch command to
- >accept an argument of any type and resolve cases using the appropriate ==
- >operator.
-
- Or any extension that achieves the same end - to allow switch to deal with
- types that don't go onto int.
-
- >no such thing as a compile-time class object constant this implies that
- >the case clause would have to be able to take an expression if
- >this proposal were accepted.
-
- Yes.
-
- >It would also mean that switch was not
- >a primitive operation (unless it happened to obey C rules in which
- >case it would optimize back to a primative operation).
-
- So far no one's suggested a reason this could not be made so.
-
- >The ability for
- >the compiler to detect duplicate cases would also be lost when varaible
- >expressions where use in case clauses (or when the == operator was not
- >inline).
-
- The compiler can still check for duplicate cases when switch devolves to
- the simple C variety, and of course this won't break code (it is more
- permissive than otherwise).
-
- >The range issue was introduced as an amendment and I was demonstrating
- >that it was redundant given the implications of the original proposal.
-
- Yah.
-
- >IMHO...
- >On balance the extension of switch to operate on any class is probably
- >unecessary and the extension to case to take ranges is therefore a good idea.
-
- I'd rather have a simple semantic extension that does the job for a broad
- range of expressions than a syntactic hack that doesn't do much of the
- job at all. Ranges won't, for a good instance, allow use of switch with
- string classes.
-
- >Adding a new syntax (or worse still token) to the language should not
- >be done lightly.
-
- You ain't just whistling dixie.
-
- --
- Internet: pete@cssc-syd.tansu.com.au UUCP: {uunet,mcvax}!munnari!cssc-syd!pete
- Snail: 1/18-20 Orion Road, Lane Cove NSW 2066 Australia Phone: +61 2 911 3130
- I am a big pond in a small fish.
-