On Fri, Jul 25, 2008 at 6:45 PM, Jamie Wilkinson <[EMAIL PROTECTED]> wrote:
> 2008/7/25 Ben Leslie <[EMAIL PROTECTED]>:
>> On Thu, Jul 24, 2008 at 6:37 AM, Adelle Hartley <[EMAIL PROTECTED]> wrote:
>>> When I'm coding in C++, I tend to spell things out more, but I put that down
>>> to my lack of knowledge & experience.
>>
>> Unless there was a reason to use the intermediate variable I would always
>> use 'run-on dereferencing'. And would probably get people to change to
>> run-on dereferencing in a code review if I saw it in other people's code.
>
> +1 with 3 exceptions:
>
> Run-on until you get to 80 characters, then use a temporary to hold
> the intermediate value so you can break the line :)
>
> I'd use an intermediate if the result of the call requires some error
> handling, as already discussed in this thread.
>
> Finally I'd use a temporary to improve readability of the code, as
> often the name you give the temporary goes a long way to explaining to
> the reader what the hell is going on.

I agree and will just add one other fairly minor consideration - if
you ever need to drop into this with a debugger after a crash, seeing
the left-behind values in locals may be useful.  (At least I find it
so in Python, but the degree to which this is useful is going to
depend greatly on the environment and the type of bugs you find in
your program.)   I don't think I've every added one specifically for
this.

-- 
Martin <http://launchpad.net/~mbp/>
_______________________________________________
coders mailing list
coders@slug.org.au
http://lists.slug.org.au/listinfo/coders

Reply via email to