Deutsch   English   Français   Italiano  
<v4rmv0$19t6u$1@dont-email.me>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!feed.opticnetworks.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Malcolm McLean <malcolm.arthur.mclean@gmail.com>
Newsgroups: comp.lang.c
Subject: Re: realloc() - frequency, conditions, or experiences about
 relocation?
Date: Tue, 18 Jun 2024 11:19:12 +0100
Organization: A noiseless patient Spider
Lines: 88
Message-ID: <v4rmv0$19t6u$1@dont-email.me>
References: <v4ojs8$gvji$1@dont-email.me> <875xu8vsen.fsf@bsb.me.uk>
 <v4ovqf$j5hq$1@dont-email.me> <87zfrjvqp6.fsf@bsb.me.uk>
 <v4pb4v$lhgk$1@dont-email.me> <87tthrvdtg.fsf@bsb.me.uk>
 <20240617181034.74fb4cca1f4a9a3ea032825e@g{oogle}mail.com>
 <86r0cuk9qz.fsf@linuxsc.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Tue, 18 Jun 2024 12:19:12 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="cba6eb24be5a0db449e57ccf4e727e7c";
	logging-data="1373406"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX19UZG1UCIEXrTNbEjT9HWSOm68eNqN9pAU="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:dZT0jPGGjgFswRrr7t4bzNqTzi4=
In-Reply-To: <86r0cuk9qz.fsf@linuxsc.com>
Content-Language: en-GB
Bytes: 5137

On 18/06/2024 08:09, Tim Rentsch wrote:
> Anton Shepelev <anton.txt@g{oogle}mail.com> writes:
> 
>> Ben Bacarisse to Malcolm McLean:
>>
>>> [next is a comment from Malcolm]
>>>
>>>> Your strategy for avoiding these extremes is exponential
>>>> growth.
>>>
>>> It's odd to call it mine.  It's very widely know and used.
>>> "The one I mentioned" might be less confusing description.
>>
>> I think it is a modern English idiom, which I dislike as
>> well.  StackOverflow is full of questions starting like:
>> "How do you do this?" and "How do I do that?"  They are
>> informal ways of the more literary "How does one do this?"
>> or "What is the way to do that?"
> 
> I have a different take here.  First the "your" of "your
> strategy" reads as a definite pronoun, meaning it refers
> specifically to Ben and not to some unknown other party.
> (And incidentally is subtly insulting because of that,
> whether it was meant that way or not.)
> 
> Second the use of "you" to mean an unspecified other person
> is not idiom but standard usage.  The word "you" is both a
> definite pronoun and an indefinite pronoun, depending on
> context.  The word "they" also has this property.  Consider
> these two examples:
> 
>     The bank downtown was robbed.  They haven't been caught
>     yet.
> 
>     They say the sheriff isn't going to run for re-election.
> 
> In the first example "they" is a definite pronoun, referring
> to the people who robbed the bank.  In the second example,
> "they" is an indefinite pronoun, referring to unspecified
> people in general (perhaps but not necessarily everyone).
> The word "you" is similar:  it can mean specifically the
> listener, or it can mean generically anyone in a broader
> audience, even those who never hear or read the statement
> with "you" in it.
> 
> The word "one" used as a pronoun is more formal, and to me
> at least often sounds stilted.  In US English "one" is most
> often an indefinite pronoun, either second person or third
> person.  But "one" can also be used as a first person
> definite pronoun (referring to the speaker), which an online
> reference tells me is chiefly British English.  (I would
> guess that this usage predominates in "the Queen's English"
> dialect of English, but I have very little experience in
> such things.)
> 
> Finally I would normally read "I" as a first person definite
> pronoun, and not an indefinite pronoun.  So I don't have any
> problem with someone saying "how should I ..." when asking
> for advice.  They aren't asking how someone else should ...
> but how they should ..., and what advice I might give could
> very well depend on who is doing the asking.

Ben said
 > Restore snipped Ben upthread
"In practice, the cost is usually
moderate and can be very effectively managed by using an exponential
allocation scheme: at every reallocation multiply the storage space by
some factor greater than 1 (I often use 3/2, but doubling is often used
as well)."

So it's open and shut, and no two ways about it. Ben's strategy is 
exponential growth. And to be fair I use that strategy myself in 
functions like fslutp(). It's only not Ben's strategy if we mean to 
imply that Ben was the first person to use expoential growth, or the 
first to understand the mathematical implications, and of course that's 
not the case. It was all worked out by Euler long before any of us were 
born.

The question is whether we can be a bit more rigorous than "we need 
exonential growth, let's double on each reallocation. Actually, that 
looks a bit greedy. Try 3/2". And we can do that. We can put it on a 
sounder statistical footing. Whether it actually worth it or not is a 
different matter.

-- 
Check out my hobby project.
http://malcolmmclean.github.io/babyxrc