Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #103431

Re: need {..} block, and switch case, need, and needs keywords

From David Brown <david.brown@hesbynett.no>
Newsgroups comp.lang.c
Subject Re: need {..} block, and switch case, need, and needs keywords
Date 2017-02-08 09:43 +0100
Organization A noiseless patient Spider
Message-ID <o7elkr$f8u$1@dont-email.me> (permalink)
References <cccf37f2-ec4b-4780-a406-ac52f46e8c79@googlegroups.com> <o7c11a$ti7$1@dont-email.me> <812f2dea-9a1e-4286-9d57-2be0213f6a53@googlegroups.com>

Show all headers | View raw


On 07/02/17 16:32, Rick C. Hodgin wrote:
> On Tuesday, February 7, 2017 at 3:39:57 AM UTC-5, David Brown wrote:
>> 	value = [[discardable]] get_something();
> 
> I think this would move the definition too far away from use, and
> require a greater effort to hunt down and discover its use when doing
> later maintenance or debugging.
> 

No, it would not.

It would make the "optional" or "discardable" nature of the call to
get_something at precisely the location you want - where get_something
is called.  And it would make the use of the variable "value" obvious
too - you use it if you need it, you don't use it if you don't need it.
 Why should the programmer also have to write "needs value" as well?

And if the programmer's use of "value" is so far away from the call that
sets it, then their function is too long and complicated - and that's
not a style to encourage.

Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

need {..} block, and switch case, need, and needs keywords "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2017-02-06 07:57 -0800
  Re: need {..} block, and switch case, need, and needs keywords BartC <bc@freeuk.com> - 2017-02-06 16:23 +0000
    Re: need {..} block, and switch case, need, and needs keywords "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2017-02-06 08:36 -0800
  Re: need {..} block, and switch case, need, and needs keywords David Brown <david.brown@hesbynett.no> - 2017-02-07 09:39 +0100
    Re: need {..} block, and switch case, need, and needs keywords "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2017-02-07 07:32 -0800
      Re: need {..} block, and switch case, need, and needs keywords David Brown <david.brown@hesbynett.no> - 2017-02-08 09:43 +0100
        Re: need {..} block, and switch case, need, and needs keywords "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2017-02-08 03:26 -0800
          Re: need {..} block, and switch case, need, and needs keywords David Brown <david.brown@hesbynett.no> - 2017-02-08 14:30 +0100
            Re: need {..} block, and switch case, need, and needs keywords "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2017-02-08 05:38 -0800
              Re: need {..} block, and switch case, need, and needs keywords "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2017-02-08 05:43 -0800

csiph-web