From: Eli Zaretskii Newsgroups: comp.os.msdos.djgpp Subject: Re: inefficiency of GCC output code & -O problem Date: Fri, 14 Apr 2000 23:27:53 +0200 Organization: NetVision Israel Lines: 28 Message-ID: <38F78D59.218E4514@is.elta.co.il> References: <38F6137B DOT 47481761 AT mtu-net DOT ru> <8d76dk$dg5$1 AT nets3 DOT rz DOT RWTH-Aachen DOT DE> <38F74CD0 DOT 6987E15A AT mtu-net DOT ru> NNTP-Posting-Host: ras1-p85.rvt.netvision.net.il Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: news.netvision.net.il 955744031 5390 62.0.172.87 (14 Apr 2000 20:27:11 GMT) X-Complaints-To: abuse AT netvision DOT net DOT il NNTP-Posting-Date: 14 Apr 2000 20:27:11 GMT X-Mailer: Mozilla 4.7 [en] (Win98; I) X-Accept-Language: en,ru,hebrew To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com "Alexei A. Frounze" wrote: > > I'm simply disappointed because of this behaviour. I've never had such problems > with other compilers (Borland Pascal/C, Warcom C). And I couldn't figure out > that I would have them. Other compilers don't have such powerful inline assembly facilities. Their inline assembly is of the ``simple and stupid'' type. > Well, I might have insufficient experience with GCC, but I couldn't figure out > that inline assembly is too difficult with GCC. No, ``too difficult'' is not the right word here. The inline assembly facilities of GCC are very powerful, in that they let you tell the compiler all the info it needs to know so that it doesn't interfere with your code when it optimizes the code it itself produces. When you use a powerful tool, you have to pay for that power in complexity. It takes time and some effort to learn to use a powerful and complex tool such as this. Unfortunately, in this case, the powerful tool is also notoriously underdocumented. I suggest to read all the available docs (somebody posted a URL a couple of weeks ago with a very good tutorial), ask lots of questions, look at lots of code produced by "gcc -S", and not to assume it will all become clear in one short session. The Linux system header files is one place to look for lots of examples of inline assembly written by people who generally know what they are doing. Heck, even DJGPP's sys/farptr.h has a few surprises for you ;-).