🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #4503

Re: Help with tree

#4503
From: Jerry Coffin
Date: Mon, 18 Dec 1995 21:27
69 lines
3761 bytes
thads@csn.net (Thad Smith) wrote:

>>As far as I can tell, there's no guarantee about anything that would
>>typically involve stack-size.  
>...
>>and add:
>>
>>- ability to call functions having any combination of arguments and
>>parameters totalling 3 variables of any type, to a total depth of 511,
>>not including the initial invocation of `main'.
>>(all three requirements applying only to hosted implementations.)

>511 sounds high, much higher than normal programs use.  That may
>exclude small implementations.  Also, 3 variables of any type is
>a loose requirement: is there any limit of the size of my struct
>variable used as an argument?

Sorry - any built-in type was what I had in mind.  It might make more
sense to reduce the maximum depth (most algorithms that _should_ be
recursive use stack space roughly proportional to log2(N), so a couple
dozen is sufficient for many purposes) and increase the variable space
allowed per invocation.  Perhaps up to a total of 8 variables of any
built in type, (including aggregations thereof into structs or unions)
and a maximum depth of 127?

Ultimately, I guess I figure once the idea and the basic framework for
the requirement is dreamt up, the committee would be likely to adjust
the numbers a bit in any case.  

>>Under the present rules, you could make a pretty good case that no
>>program that uses a variable is strictly conforming, since there's no
>>guarantee as to whether any amount of storage is supported in the
>>storage class used by that variable.

>Good point.  The problem seems to be defining some guaranteed numbers
>and determining how they apply.  In this scenario, do I loose all
>guarantees because I have 2 parameters, but need a local variable,
>even though the call depth is 3 instead of 511?  

The idea I had in mind was a total number of variables per invocation,
as either parameters OR local variables.  I suppose you could instead
give a minimum depth of recursion that has to be supported regardless,
and require X bytes of local variables, regardless of whether they're
all created in main, or by calls (recursive or otherwise) to other
functions.  Given that I'd already had 32767 bytes of local variables as
a requirement, it might make the most sense to skip a specific limit per
invocation and require 128 levels of calls be supported, and the 32767
bytes of local storage could be used in any fashion desired.

>Maybe a more practical way of handling this situation (outside the
>standard) is to specify the amount of memory required to run a
>particular program is some/all cases.  This, of course, is somewhat
>difficult to specify for portable programs because of varying sizes of
>variable types.

And also due (in some cases) to variations in the data.  OTOH,
regardless of variations in data, if you can't assure yourself of
maximum memory usage, at least relative to the amount of data, it's
likely difficult to assure yourself of correct operation either.  E.g.
if you don't know what the limit on recursion is, you may have missed
the fact that with the wrong data, it's infinite...
    Later,
    Jerry.

/* I can barely express my own opinions; I certainly can't
 * express anybody else's.
 *
 * The universe is a figment of its own imagination.
 */
Technical Details
Message-ID: <4b4i1v$9vg@natasha.rmii.com>
Path: arc1-ca.pugleaf.net!news.rmii.com!usenet
References: <4aqgq5$53f@newsbf02.news.aol.com> <4asgpq$280@elf.bsdi.com> <4av6pn$8im@natasha.rmii.com> <Z840wQ9yt1pR084yn@csn.net>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!news.rmii.com!usenet
From: jcoffin@rmii.com (Jerry Coffin)
Newsgroups: comp.std.c
Subject: Re: Help with tree
Date: Mon, 18 Dec 1995 21:27:34 GMT
Organization: TAEUS
Message-ID: <4b4i1v$9vg@natasha.rmii.com>
References: <4aqgq5$53f@newsbf02.news.aol.com> <4asgpq$280@elf.bsdi.com> <4av6pn$8im@natasha.rmii.com> <Z840wQ9yt1pR084yn@csn.net>
NNTP-Posting-Host: slip8144.rmii.com
X-Newsreader: Forte Free Agent 1.0.82