Re: [Vala] Why the temporary variables in the C code are usefull ?

On Thu, Jul 07, 2011 at 12:09:16PM -0500, Jim Peters wrote:
Jacques-Pascal Deplaix wrote:
What are the side effects corrected by the temporary variables ?

Unwanted side effects can happen if you evaluate an expression more
than once, e.g. if you substituted the full expression for every
_tmp2_ in the C code.  Expressions with side-effects include function
calls and stuff which modifies variables, e.g. p++.  You don't want to
do 'p++' twice or call the function twice.

As the other poster said, C compilers are very good at optimising away
temporary variables.

There've been a number of refactoring lately that will hopefully lead to
dropping lots of useless temporary variables. That's for the sake of C
code readability and smaller C code footprint.

-- - The Universal Operating System

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]