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


Groups > comp.lang.c++ > #10301

Re: Thoughts on function

From Ian Collins <ian-news@hotmail.com>
Newsgroups comp.lang.c++
Subject Re: Thoughts on function
Date 2011-09-20 07:44 +1200
Message-ID <9dpkdqFr5dU17@mid.individual.net> (permalink)
References (5 earlier) <880af656-7aaf-4e4c-baa8-91ae77d541e4@f41g2000yqh.googlegroups.com> <9dn6ekFr5dU8@mid.individual.net> <d5a55708-e02d-4409-8ee1-7c23573e0a51@c22g2000yqa.googlegroups.com> <9dnvkbFr5dU13@mid.individual.net> <0deff799-9602-458f-95fd-6e64d613e37c@w28g2000yqw.googlegroups.com>

Show all headers | View raw


On 09/20/11 06:16 AM, Ebenezer wrote:
> On Sep 18, 11:43 pm, Ian Collins<ian-n...@hotmail.com>  wrote:
>> On 09/19/11 01:25 PM, Ebenezer wrote:>  On Sep 18, 4:34 pm, Ian Collins<ian-n...@hotmail.com>    wrote:
>>>> On 09/19/11 08:30 AM, Ebenezer wrote:
>>>>> On Sep 15, 7:23 pm, Ebenezer<woodbria...@gmail.com>      wrote:
>>
>>>>>> ending:
>>>>>>      buf_.erase(buf_.begin(), buf_.begin() + numWritten);
>>>>>>      if (numWritten == all) return true;
>>
>>>>>>      partialFlush = true;
>>>>>>      return false;
>>>>>> }
>>
>>>>> How would you rate this function -- with a 1 being terrible
>>>>> and a 10 being excellent?
>>
>>>> You don't appear to have headed any of the suggestions.
>>
>>> I'm not opposed to the size_t suggestion, but am wanting to
>>> focus on the bigger picture.
>>
>>>> At review, I'd still give it a 1 because it isn't clear what it does,
>>>> why it uses fixed width types and it still contains gratuitous gotos.
>>
>>> All of the code is free -- gratuitous.  Meanwhile no one has
>>> provided an alternative they think is better.
>>
>> Everything at after your ending label could be in a bool returning
>> member function.
>>
>
> OK, so if I work on an implementation like that would you
> suggest making some of the local variables member variables?
> The added function needs to access numWritten, all and partialFlush.

Well you've already made partialFlush static, so it's a obvious 
contender for a a member variable.  The other two could be parameters.

-- 
Ian Collins

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


Thread

Thoughts on function Ebenezer <woodbrian77@gmail.com> - 2011-09-14 22:01 -0700
  Re: Thoughts on function Ian Collins <ian-news@hotmail.com> - 2011-09-15 17:08 +1200
    Re: Thoughts on function Ebenezer <woodbrian77@gmail.com> - 2011-09-15 07:34 -0700
      Re: Thoughts on function Ian Collins <ian-news@hotmail.com> - 2011-09-16 07:38 +1200
        Re: Thoughts on function Leigh Johnston <leigh@i42.co.uk> - 2011-09-15 20:40 +0100
        Re: Thoughts on function Ebenezer <woodbrian77@gmail.com> - 2011-09-15 17:23 -0700
          Re: Thoughts on function Ebenezer <woodbrian77@gmail.com> - 2011-09-18 13:30 -0700
            Re: Thoughts on function Ian Collins <ian-news@hotmail.com> - 2011-09-19 09:34 +1200
              Re: Thoughts on function Ebenezer <woodbrian77@gmail.com> - 2011-09-18 18:25 -0700
                Re: Thoughts on function Geoff <geoff@invalid.invalid> - 2011-09-18 19:08 -0700
                Re: Thoughts on function Ebenezer <woodbrian77@gmail.com> - 2011-09-18 19:46 -0700
                Re: Thoughts on function Geoff <geoff@invalid.invalid> - 2011-09-18 20:12 -0700
                Re: Thoughts on function Ebenezer <woodbrian77@gmail.com> - 2011-09-18 21:28 -0700
                Re: Thoughts on function Miles Bader <miles@gnu.org> - 2011-09-19 13:26 +0900
                Re: Thoughts on function Ian Collins <ian-news@hotmail.com> - 2011-09-19 16:45 +1200
                Re: Thoughts on function Miles Bader <miles@gnu.org> - 2011-09-19 15:19 +0900
                Re: Thoughts on function Ian Collins <ian-news@hotmail.com> - 2011-09-19 16:43 +1200
                Re: Thoughts on function Ebenezer <woodbrian77@gmail.com> - 2011-09-19 11:16 -0700
                Re: Thoughts on function Ian Collins <ian-news@hotmail.com> - 2011-09-20 07:44 +1200
                Re: Thoughts on function Ebenezer <woodbrian77@gmail.com> - 2011-09-19 18:03 -0700
                Re: Thoughts on function Ian Collins <ian-news@hotmail.com> - 2011-09-20 13:15 +1200
                Re: Thoughts on function Ebenezer <woodbrian77@gmail.com> - 2011-09-19 18:27 -0700
  Re: Thoughts on function Fulvio Esposito <esposito.fulvio@gmail.com> - 2011-09-16 02:19 -0700
    Re: Thoughts on function Ebenezer <woodbrian77@gmail.com> - 2011-09-16 11:20 -0700
      Re: Thoughts on function Fulvio Esposito <esposito.fulvio@gmail.com> - 2011-09-16 13:51 -0700
  Re: Thoughts on function hanukas <jukka@liimatta.org> - 2011-09-19 06:19 -0700

csiph-web