Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!usc!snorkelwacker!bloom-beacon!eru!luth!sunic!mcsun!ukc!icdoc!mvax.cc.ic.ac.uk!cc.ic.ac.uk!rb From: rb@cc.ic.ac.uk (Robin Becker) Newsgroups: comp.std.c++ Subject: Re: case() Message-ID: <1990Aug23.182857.107@cc.ic.ac.uk> Date: 23 Aug 90 18:28:57 GMT Sender: news@cc.ic.ac.uk (USENET News System) Reply-To: rb@cc.ic.ac.uk (Robin Becker) Organization: Imperial College Computer Center, London, UK Lines: 11 There seems to be a fundamental reason why case/switch statements with variable/expression tags are to be avoided and that is the impossibility of guaranteeing that a unique tag will be selected. This means that either some ordering of tag interrogation has to be imposed which will kill optimisations (unless all tags are constant) or we abandon determinism and let the compiler decide. Of course this construct has been discussed before by Hoare, I seem to remember something about programs shouldn't depend on the order of guard evaluation. Even worse in parallel processing two guards may get evaluated to true so parallel languages like Occam must do something about this, but I don't know what.