On Fri, Jan 31, 2014 at 4:55 PM, Petter Reinholdtsen <p...@hungry.com> wrote:
> [Zdenek Styblik]
>> Sure. Not only you're reusing variable name, you're declaring it
>> deep inside the function/code. So no.
>
> Right.  Then I understand what you mean.
>
> Declaring variables close to where they are used is normally
> considered good coding practice, not a problem.  Or as
> <URL:http://www.lrdev.com/lr/c/ccgl.html#scopevariable> put it: "The
> variable scope should be as small as possible".  There is no overhead
> in using variables in code blocks, so there is really do downside to
> keeping the scope of variables small.
>
> Why do you believe variables should be given function scope instead of
> block scope, when the variable is only used in a small block in a
> function?
>
> The variable in question is the return value, rv for short, and given
> that the scope is limited to the few lines, it seemed to me that it
> gave more consistent naming of variables by using 'rv' for return
> value both places, but I realise that is a matter of opinion .  I am
> happy to give return values different names. :)
>

Scope, sure. But I'll be damned if what you're trying to sell, that is
to re-use variable name with different data types, is good practice.
But hey, it's your commit. I'm sure you know better.

Z.


> --
> Happy hacking
> Petter Reinholdtsen
>
> ------------------------------------------------------------------------------
> WatchGuard Dimension instantly turns raw network data into actionable
> security intelligence. It gives you real-time visual feedback on key
> security issues and trends.  Skip the complicated setup - simply import
> a virtual appliance and go from zero to informed in seconds.
> http://pubads.g.doubleclick.net/gampad/clk?id=123612991&iu=/4140/ostg.clktrk
> _______________________________________________
> Ipmitool-devel mailing list
> Ipmitool-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/ipmitool-devel

------------------------------------------------------------------------------
WatchGuard Dimension instantly turns raw network data into actionable 
security intelligence. It gives you real-time visual feedback on key
security issues and trends.  Skip the complicated setup - simply import
a virtual appliance and go from zero to informed in seconds.
http://pubads.g.doubleclick.net/gampad/clk?id=123612991&iu=/4140/ostg.clktrk
_______________________________________________
Ipmitool-devel mailing list
Ipmitool-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ipmitool-devel

Reply via email to