[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Change #1 Considered Harmful

From: Branko Èibej <brane_at_xbc.nu>
Date: 2001-02-06 19:13:39 CET

Bob Miller wrote:

> Jim Blandy wrote:
>
>> I guess I think it's weird to have an interface that supports the
>> feature of "I decided not to use this interface." Usually, if you're
>> not sure you want to perform an operation yet, you just don't perform
>> it.
>
>
> No, it's good to be able to create a thing without using it.
> We do it all the time with variables, for example.
>
> void foo()
> {
> int may_be_used;
>
> if (some_condition) {
> may_be_used = bar();
> if (may_be_used)
> baz();
> }
> }
>
> Wouldn't you hate to have to structure your code so you only
> "executed" declarations of those variables you actually used?

Heh. Now /that/ is a controversial statement. No, I'd l'd love it, and
in your example I'd put the declaration inside the scope of the
if-statement.

It's basically a tradeoff between the cost of creating something you may
have to throw away unused, and making sure you're really going to need it.

-- 
Brane �ibej
    home:   <brane_at_xbc.nu>             http://www.xbc.nu/brane/
    work:   <branko.cibej_at_hermes.si>   http://www.hermes-softlab.com/
     ACM:   <brane_at_acm.org>            http://www.acm.org/
Received on Sat Oct 21 14:36:21 2006

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.