Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!wuarchive!texbell!sugar!ficc!peter From: peter@ficc.uu.net (Peter da Silva) Newsgroups: comp.lang.c Subject: Re: The final word on GOTO (Don't I wis Message-ID: <6396@ficc.uu.net> Date: 3 Oct 89 14:42:18 GMT References: <20324@<1989Sep14> <225800222@uxe.cso.uiuc.edu> <4208@cbnewsh.ATT.COM> <1051@kim.misemi> Distribution: na Organization: Xenix Support, FICC Lines: 47 The last time I looked at a stdio library there was a goto in _doprnt: if you see a % handle number.number stuff see what the format is switch(format) { case 'd': base = 10; if(number < 0) { sign = '-'; number = -number; } else sign = 0; ... goto donum; case 'u': base = 10; sign = 0; ... goto donum; case 'o': base = 8; sign = 0; ... goto donum; case 'x': base = 16; sign = 0; ... goto donum; donum: format number with base, sign, etc. (yes, I know this won't work for -32768. It's just an example) You could probably rearrange this to not need the gotos, but I really don't see that it would make the code any clearer. That's the problem. Sometimes just leaving the goto in makes the code easier to read. Really. A goto isn't the devil, it's just a seldom used ingredient. Like blue food coloring... you don't use it often, but would you ban it from the kitchen? -- Peter da Silva, *NIX support guy @ Ferranti International Controls Corporation. Biz: peter@ficc.uu.net, +1 713 274 5180. Fun: peter@sugar.hackercorp.com. `-_-' "That is not the Usenet tradition, but it's a solidly-entrenched U delusion now." -- brian@ucsd.Edu (Brian Kantor)