Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!rutgers!princeton!allegra!alice!ark From: ark@alice.UUCP Newsgroups: comp.lang.c Subject: Re: Long Branches Message-ID: <6552@alice.uUCp> Date: Mon, 19-Jan-87 00:00:32 EST Article-I.D.: alice.6552 Posted: Mon Jan 19 00:00:32 1987 Date-Received: Tue, 20-Jan-87 00:11:04 EST References: <3950006@nucsrl.UUCP> Organization: AT&T Bell Laboratories, Liberty Corner NJ Lines: 21 In article <3950006@nucsrl.UUCP>, ram@nucsrl.UUCP writes: > > I have a problem in using the C compiler and VAX assembler in our local > 4.3BSD(VAX) site. I have a program which has a huge(>900lines) case statement. > > /* Whoever said that programmers(pro) don't use case/switch */ > > The assembler chokes on (>32K long) long branches. Apparently > there is a flag "-J" for such purposes (in the assembler) > which does not seem to work. The trouble is that a case statement does not generate jump instructions on the VAX. Instead it generates a CASE instruction. This instruction also comes in three flavors: byte, word, and longword offsets. It would not be enough for the assembler to translate the CASEW the compiler probably generates into a CASEL: the jump table must be translated from words to longwords too. Portable solutions? I suppose the best bet is to make the switch statement smaller. One way to do this might be to replace some of the bigger cases by jumps to code outside the switch statement itself. Ick.