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


Groups > comp.lang.c > #94250

Re: old c

From Ben Bacarisse <ben.usenet@bsb.me.uk>
Newsgroups comp.lang.c
Subject Re: old c
Date 2016-09-29 17:13 +0100
Organization A noiseless patient Spider
Message-ID <87k2du8z1r.fsf@bsb.me.uk> (permalink)
References <qr5fub15dtp0k7pn5f8757638pfergcnhk@4ax.com> <874m54ffaa.fsf@bsb.me.uk> <1a026825-ed22-4804-8dd3-8d118e8db311@googlegroups.com> <87ponn81od.fsf@bsb.me.uk> <nsj7e6$8l0$1@jstuckle.eternal-september.org>

Show all headers | View raw


Jerry Stuckle <jstucklex@attglobal.net> writes:

> On 9/29/2016 6:01 AM, Ben Bacarisse wrote:
>> Malcolm McLean <malcolm.mclean5@btinternet.com> writes:
>> 
>>> On Sunday, September 25, 2016 at 11:24:40 AM UTC+1, Ben Bacarisse wrote:
>>>> Rosario19 <Ros@invalid.invalid> writes:
>>>>
>>>>> i think
>>>>> in the compiler i use code as
>>>>>
>>>>> int v;g(u){v=strlen(u);}
>>>>> main(){return v==g("main");}
>>>>>
>>>>> would compile...
>>>>
>>>> You may want to aim higher -- just managing to get some code to generate
>>>> an executable is a rather low bar, especially since C compilers tend to
>>>> be very generous in overlooking problems.
>>>>
>>> Say you've got some legacy code written in the 1970s which is a madman's
>>> attempt at solving the halting problem, and on a now obsolete ferrite
>>> core machine, it does work.
>>>
>>> It's worth studying, but the ferrite core machine is on its last
>>> legs and no-one can now compile C source for it. But the code is, 
>>> obviously, a tangled web that works on some algorithmic principle
>>> that only the madman understood, and he's now sadly deceased, he 
>>> can't tell you how he did it any more.
>> 
>> Obviously we are in agreement that one should aim higher than just
>> getting some C code to generate an executable.  Had the madman been
>> given (and taken) such advice we would not be in this situation.
>> 
>>> So what to do? Best bet is to compile and run it, and verify that
>>> it actually does solve the halting problem, at least on any inputs
>>> you can devise. Then insert diagnostic printfs or step through it
>>> in a debugger, and gradually try to work out how it achieves it.
>> 
>> But here we disagree.  I've never come across a program that is easier
>> to understand dynamically than it is to understand statically.  If the
>> machine's documentation is not available, you might well want to write
>> and run some small test programs to find out what various constructs do,
>> but once you know the answers to these questions, it's always going to
>> be easier to understand a program "on paper".  For anything but trivial
>> algorithms, dynamic execution traces through the static code tell you
>> very little compared to a step by step deconstruction of the program's
>> necessarily finite text.
>> 
>> <snip>
>> 
>
> I have - many times.  When a program gets to be too big, you can get
> lost in the details without understanding the overall picture
> (forest/trees problem).  In cases like this, it is often helpful to draw
> a flow chart to get an overall picture of what's going on.  It's easier
> when you can understand the dynamics of the program's operation.

We may be talking at cross purposes here.  I'm talking about the method
of gaining that understanding.

> When you're talking 100K+ LOC and thousands of functions, you just can't
> look at the code and understand how it operates - even if it is
> commented.

I've never found it helpful to watch a few of the billions upon billions
of execution traces that such a large program is capable of.  But I am
happy to note a difference between up here and leave it at that.

-- 
Ben.

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


Thread

old c Rosario19 <Ros@invalid.invalid> - 2016-09-25 11:41 +0200
  Re: old c Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-09-25 11:24 +0100
    Re: old c Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-09-28 21:08 -0700
      Re: old c Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-09-29 11:01 +0100
        Re: old c Jerry Stuckle <jstucklex@attglobal.net> - 2016-09-29 10:11 -0400
          Re: old c Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-09-29 17:13 +0100
            Re: old c Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-09-29 09:51 -0700
            Re: old c Jerry Stuckle <jstucklex@attglobal.net> - 2016-09-29 17:15 -0400
        Re: old c supercat@casperkitty.com - 2016-09-30 08:03 -0700
  Re: old c luser droog <luser.droog@gmail.com> - 2016-09-25 11:13 -0700
    Re: old c jgk@panix.com (Joe keane) - 2016-09-28 21:02 +0000
      Re: old c luser droog <luser.droog@gmail.com> - 2016-09-28 15:28 -0700

csiph-web