Re: Donkey Strikes Again !
- From: randyhyde@xxxxxxxxxxxxx
- Date: 28 Jul 2005 19:18:03 -0700
>
> Noting that Donkey cannot censure or close posting in this newsgroup, I
> will correct BOTH of you here yet again as flogging this blunder
> misleads programmrs who are trying to learn assembler.
Hutch, now you're starting to sound like Rene, and that's *scary*.
> Now while I am used to f0dder rowing his own boat at the expense of
> beginner programmers, it is not something I expect from Donkey who has
> an excellent track record of helping people learning assembler.
>
> As with f0dder, I would expect Donkey to correct this technical mistake
> and not make it again as the register preservation convention for
> Windows is simple if you get it the right way the first time.
Having read through the posts now, I'm afraid I have to agree with
Donkey and f0dder here. The problem is that you're using a definition
of "preserves" that doesn't quite match the standard meaning. From the
URL f0dder provided, definition two:
2. To keep in perfect or unaltered condition; maintain unchanged.
This is *all* preserve means. You seem to think that "preserve" is an
*active* verb, requiring the emission of machine instructions to
explicitly save a register value and explicitly restore that value
later on. Preserve does not require this. All preserve means is that
when you leave a procedure, the (affected) registers have the same
values they had upon entry. You may *passively* preserve a register by
simply NOT CHANGING ITS VALUE during the procedure's execution. As
best I can tell, this is exactly what f0dder is saying. What you're
interpreting him to say is that you must push these registers and pop
their values, if you're "preserving" them. But that's not what he's
saying (nor Donkey, nor I).
I suspect the term you're thinking of is "restore" (as in "save and
restore"). Register restoration *is* an active operation, requiring the
execution of instructions (to first save and then later restore those
registers). f0dder, in no post I've seen, is suggesting that you must
always save and restore registers; only that you must preserve their
values. Saving and restoring registers is how you preserve their values
when you make changes to those register values, but saving and
restoring is not required if no modifications are made to the register
values during a procedure's execution. As best I can tell, this is were
the confusion lies in this argument.
As a side point, it *is* good advice to a beginner to tell them to
always save and restore all the important register values. Even above
and beyond preservation. When code is maintained and enhanced in the
future, people have a habit of using new registers and forgetting to
preserve their values, thus creating problems. For the few extra bytes
and cycles a pushad/popad pair can save a lot of headaches down the
road. Beginners have a hard time handling push/pop mismatches and
register trashing errors, so teaching them to pushad/popad is good
advice (particularly in code like WindProc which is *not* time
critical). Later on, they can revisit the advice to save and restore
everything if they have a need to do so. But in the meantime, they'll
have far fewer problems if they get in the habit of saving and
restoring everything.
I hate to say this, but you're acting like Rene in more ways than one
here. Running off to ALA where "freedom of speech" lets you post
anything you like and continuing to use incorrect definitions of terms,
even when the correct definition is there for you to see, is what we've
come to expect from Rene all these years. Don't fall into that same
trap.
Cheers,
Randy Hyde
.
- Follow-Ups:
- Re: Donkey Strikes Again !
- From: Betov
- Re: Donkey Strikes Again !
- From: Betov
- Re: Donkey Strikes Again !
- From: f0dder
- Re: Donkey Strikes Again !
- Prev by Date: Re: C'Mon, this *isn't* Rocket Science
- Next by Date: Re: C'Mon, this *isn't* Rocket Science
- Previous by thread: Re: Donkey Strikes Again !
- Next by thread: Re: Donkey Strikes Again !
- Index(es):
Relevant Pages
|