From: "A. Sinan Unur" Newsgroups: comp.os.msdos.djgpp Subject: Re: How is switch implemented? Date: Wed, 02 Apr 1997 14:15:22 -0500 Organization: Cornell University Sender: asu1 AT cornell DOT edu (Verified) Message-ID: <3342B04A.37BC@cornell.edu> References: <5hu99c$2t1 AT tuba DOT cs DOT indiana DOT edu> Reply-To: asu1 AT cornell DOT edu NNTP-Posting-Host: 128 Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Lines: 25 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Jeff Standish wrote: > I'm assuming that most intelligent compilers would try to use an jump > table, but I don't know for certain, and I'm not in the mood to compile, > disassemble, and try to read the machine code. Besides, just because > this might happen for a trivial test program doesn't mean it will also > work for 40+ cases spread out over several hundred lines of code (which > is the minimum of what I expect to write). in the case of djgpp, you can specify a command line option that will give you the assembly source files ( i think it was -S but i am at school and cannot check now) however, just go to the info docs and look at the section on invoking gcc. > > And I'm asking this in a more general sense, since in addition to DJGPP > I also use Visual C++ > Does anyone know enough about the internals of compilers these days to > answer this one? in the case of djgpp, you can compile your actual code and take a look at the assembly source rather than pure hex. i really do not know much about the internals of the compilers but i saw it mentioned somewhere that larger switch statements are more likely to be implemented using jump tables. -- sinan