Mail Archives: djgpp/2000/04/14/17:29:43
"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 ;-).
- Raw text -