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


Groups > comp.lang.c > #100517

Re: while loop vs do while loop reading from the file issue

From Keith Thompson <kst-u@mib.org>
Newsgroups comp.lang.c
Subject Re: while loop vs do while loop reading from the file issue
Date 2016-12-29 13:57 -0800
Organization None to speak of
Message-ID <lny3yyz9cq.fsf@kst-u.example.com> (permalink)
References (16 earlier) <87r357zgq3.fsf@bsb.me.uk> <4fd933b6-d713-43b4-9d3c-06657a4bcb91@googlegroups.com> <ec373472-53cd-42e0-8c52-858178796bba@googlegroups.com> <kfn60m2whn7.fsf@x-alumni2.alumni.caltech.edu> <91224c12-a127-4a5d-b64a-67a2e0a6565e@googlegroups.com>

Show all headers | View raw


Malcolm McLean <malcolm.mclean5@btinternet.com> writes:
> On Thursday, December 29, 2016 at 9:27:16 PM UTC, Tim Rentsch wrote:
>> supercat@casperkitty.com writes:
>> > On Friday, December 16, 2016 at 4:19:41 PM UTC-6, Malcolm McLean wrote:
>> >> Now I had thought that the C while was robust to creating non-
>> >> structured programs.  But I think now it is not.  But it's not quite
>> >> clear to me which rule you are breaking and why.
>> >
>> > Conditional tests aren't allowed to have side-effects in the traditional
>> > pattern, [...]
>> 
>> Wrong.
>>
> I don't think so. We have boxes which do something, and control always 
> enters at the top and comes out at the bottom, and in the box we have
> a bit of text saying what the box does. Now of course we can expand
> most boxes, unless that box is a single machine instruction. Then
> we also have diamonds. Control does not always enter from the top,
> it can also enter from the spare vertex, and there are two (always 
> exactly two) control paths out. On the diamond we write the conditions
> of the test. But I'm not sure we can expand the diamonds, I think that
> is disallowed.

Disallowed by what or whom?

>                Certainly, if we expand the diamonds, we've lost a
> primary property, because whilst the block has one point of entry
> and of exit, a diamond has two points of exit and possibly two points 
> of entry. So a diamond is not a sub-program.

You are describing what *you* think of as structured programming, but
you're providing no basis for your claims about it.

Tim cited a source, Dijkstra's "Notes on Structured Programming".
What's your source?  If you have none, perhaps you could call it
Malcolm-structured programming to avoid confusion.

-- 
Keith Thompson (The_Other_Keith) kst-u@mib.org  <http://www.ghoti.net/~kst>
Working, but not speaking, for JetHead Development, Inc.
"We must do something.  This is something.  Therefore, we must do this."
    -- Antony Jay and Jonathan Lynn, "Yes Minister"

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


Thread

Re: while loop vs do while loop reading from the file issue Tim Rentsch <txr@alumni.caltech.edu> - 2016-12-29 13:27 -0800
  Re: while loop vs do while loop reading from the file issue Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-12-29 13:41 -0800
    Re: while loop vs do while loop reading from the file issue Keith Thompson <kst-u@mib.org> - 2016-12-29 13:57 -0800
      Re: while loop vs do while loop reading from the file issue Gareth Owen <gwowen@gmail.com> - 2016-12-29 22:55 +0000
        Re: while loop vs do while loop reading from the file issue Keith Thompson <kst-u@mib.org> - 2016-12-29 15:34 -0800
    Re: while loop vs do while loop reading from the file issue Tim Rentsch <txr@alumni.caltech.edu> - 2017-01-13 02:51 -0800

csiph-web