Re: Swapping thing
From: Ioannis Vranos (ivr_at_guesswh.at.grad.com)
Date: 06/28/04
- Next message: Malcolm: "Re: Wanted:Free C program with test suite"
- Previous message: Howard: "Re: Swapping thing"
- In reply to: Howard: "Re: Swapping thing"
- Next in thread: Howard: "Re: Swapping thing"
- Reply: Howard: "Re: Swapping thing"
- Reply: Dan Pop: "Re: Swapping thing"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Mon, 28 Jun 2004 22:36:56 +0300
Howard wrote:
> "Ioannis Vranos" <ivr@guesswh.at.grad.com> wrote in message
> news:cbprc1$6tu$3@ulysses.noc.ntua.gr...
>
>
>>You are right about that, however in reality a decent swap
>>implementation would check if the passed arguments have the same value
>>so as to avoid unneeded operations.
>>
>
>
> And the need for that check is exactly one of the arguments for why this
> choice of implementation was no better than using a temporary variable in
> the first place. If you can afford the space for the code to check this
> condition, then you can surely afford the space for the temporary integer
> variable instead.
I think the non-temporary requirement is not for space concerns but to
find out how c00l we are. :-) Even under severe space concerns there is
always space for a *temporary* variable. If there are space concerns to
the extreme, then we should write numbers in its memory directly. :-)
Regards,
Ioannis Vranos
- Next message: Malcolm: "Re: Wanted:Free C program with test suite"
- Previous message: Howard: "Re: Swapping thing"
- In reply to: Howard: "Re: Swapping thing"
- Next in thread: Howard: "Re: Swapping thing"
- Reply: Howard: "Re: Swapping thing"
- Reply: Dan Pop: "Re: Swapping thing"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|