Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c++ > #79175 > unrolled thread
| Started by | jacobnavia <jacob@jacob.remcomp.fr> |
|---|---|
| First post | 2021-04-22 18:58 +0200 |
| Last post | 2021-04-26 18:04 +0200 |
| Articles | 20 on this page of 96 — 27 participants |
Back to article view | Back to comp.lang.c++
Text editor project in C jacobnavia <jacob@jacob.remcomp.fr> - 2021-04-22 18:58 +0200
Re: Text editor project in C Bonita Montero <Bonita.Montero@gmail.com> - 2021-04-22 19:05 +0200
Re: Text editor project in C wij <wyniijj@gmail.com> - 2021-04-22 12:41 -0700
Re: Text editor project in C Juha Nieminen <nospam@thanks.invalid> - 2021-04-23 07:38 +0000
Re: Text editor project in C wij <wyniijj@gmail.com> - 2021-04-23 05:12 -0700
Re: Text editor project in C red floyd <myob@its.invalid> - 2021-04-23 09:24 -0700
Re: Text editor project in C James Kuyper <jameskuyper@alumni.caltech.edu> - 2021-04-23 16:59 -0400
Re: Text editor project in C wij <wyniijj@gmail.com> - 2021-04-23 21:43 -0700
Re: Text editor project in C Ian Collins <ian-news@hotmail.com> - 2021-04-24 17:05 +1200
Re: Text editor project in C wij <wyniijj@gmail.com> - 2021-04-24 00:50 -0700
Re: Text editor project in C "daniel...@gmail.com" <danielaparker@gmail.com> - 2021-04-24 08:50 -0700
Re: Text editor project in C wij <wyniijj@gmail.com> - 2021-04-24 10:41 -0700
Re: Text editor project in C Öö Tiib <ootiib@hot.ee> - 2021-04-25 06:19 -0700
Re: Text editor project in C wij <wyniijj@gmail.com> - 2021-04-25 10:23 -0700
Re: Text editor project in C Öö Tiib <ootiib@hot.ee> - 2021-04-25 12:46 -0700
Re: Text editor project in C wij <wyniijj@gmail.com> - 2021-04-25 20:34 -0700
Re: Text editor project in C Öö Tiib <ootiib@hot.ee> - 2021-04-28 09:57 -0700
Re: Text editor project in C wij <wyniijj@gmail.com> - 2021-04-29 10:56 -0700
Re: Text editor project in C jacobnavia <jacob@jacob.remcomp.fr> - 2021-04-27 18:31 +0200
Re: Text editor project in C David Brown <david.brown@hesbynett.no> - 2021-04-28 09:01 +0200
Re: Text editor project in C Manfred <noname@add.invalid> - 2021-04-28 14:54 +0200
Re: Text editor project in C Juha Nieminen <nospam@thanks.invalid> - 2021-04-29 04:47 +0000
Re: Text editor project in C Paavo Helde <myfirstname@osa.pri.ee> - 2021-04-29 11:42 +0300
Re: Text editor project in C Christian Gollwitzer <auriocus@gmx.de> - 2021-04-29 23:04 +0200
Re: Text editor project in C Juha Nieminen <nospam@thanks.invalid> - 2021-04-23 07:55 +0000
Re: Text editor project in C jacobnavia <jacob@jacob.remcomp.fr> - 2021-04-23 11:25 +0200
Re: Text editor project in C "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2021-04-23 12:45 -0700
Re: Text editor project in C jacobnavia <jacob@jacob.remcomp.fr> - 2021-04-23 22:29 +0200
Re: Text editor project in C "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2021-04-23 13:34 -0700
Re: Text editor project in C "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2021-04-23 13:37 -0700
Re: Text editor project in C jacobnavia <jacob@jacob.remcomp.fr> - 2021-04-23 22:40 +0200
Re: Text editor project in C "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2021-04-23 13:51 -0700
Re: Text editor project in C "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2021-04-23 13:55 -0700
Re: Text editor project in C jacobnavia <jacob@jacob.remcomp.fr> - 2021-04-23 23:02 +0200
Re: Text editor project in C "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2021-04-23 14:13 -0700
Re: Text editor project in C "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2021-04-23 15:39 -0700
Re: Text editor project in C Bart <bc@freeuk.com> - 2021-04-24 01:20 +0100
Re: Text editor project in C "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2021-04-23 17:43 -0700
Re: Text editor project in C kegs@provalid.com (Kent Dickey) - 2021-04-25 00:04 -0500
Re: Text editor project in C "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2021-04-24 22:29 -0700
Re: Text editor project in C "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2021-04-24 23:05 -0700
Re: Text editor project in C Paavo Helde <myfirstname@osa.pri.ee> - 2021-04-25 10:57 +0300
Re: Text editor project in C "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2021-04-25 01:18 -0700
Re: Text editor project in C Paavo Helde <myfirstname@osa.pri.ee> - 2021-04-25 11:28 +0300
Re: Text editor project in C James Kuyper <jameskuyper@alumni.caltech.edu> - 2021-04-25 15:02 -0400
Re: Text editor project in C "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2021-04-26 01:25 -0700
Re: Text editor project in C "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2021-04-26 01:26 -0700
Re: Text editor project in C "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2021-04-23 14:15 -0700
Re: Text editor project in C scott@slp53.sl.home (Scott Lurndal) - 2021-04-23 22:25 +0000
Re: Text editor project in C "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2021-04-23 15:31 -0700
Re: Text editor project in C "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2021-04-23 13:38 -0700
Re: Text editor project in C scott@slp53.sl.home (Scott Lurndal) - 2021-04-23 22:27 +0000
Re: Text editor project in C "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2021-04-23 15:34 -0700
Re: Text editor project in C scott@slp53.sl.home (Scott Lurndal) - 2021-04-24 16:33 +0000
Re: Text editor project in C "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2021-04-24 22:59 -0700
Re: Text editor project in C Juha Nieminen <nospam@thanks.invalid> - 2021-04-26 05:22 +0000
Re: Text editor project in C jacobnavia <jacob@jacob.remcomp.fr> - 2021-04-26 10:00 +0200
Re: Text editor project in C Juha Nieminen <nospam@thanks.invalid> - 2021-04-26 09:57 +0000
Re: Text editor project in C Robert Latest <boblatest@yahoo.com> - 2021-04-26 10:41 +0000
Re: Text editor project in C jacobnavia <jacob@jacob.remcomp.fr> - 2021-04-26 13:20 +0200
Re: Text editor project in C Juha Nieminen <nospam@thanks.invalid> - 2021-04-26 13:17 +0000
Re: Text editor project in C jacobnavia <jacob@jacob.remcomp.fr> - 2021-04-26 19:53 +0200
Re: Text editor project in C David Brown <david.brown@hesbynett.no> - 2021-04-26 20:34 +0200
Re: Text editor project in C jacobnavia <jacob@jacob.remcomp.fr> - 2021-04-26 22:49 +0200
Re: Text editor project in C David Brown <david.brown@hesbynett.no> - 2021-04-27 10:59 +0200
Re: Text editor project in C Ben Bacarisse <ben.usenet@bsb.me.uk> - 2021-04-26 22:04 +0100
Re: Text editor project in C Eli the Bearded <*@eli.users.panix.com> - 2021-04-26 22:19 +0000
Re: Text editor project in C Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2021-04-26 16:07 -0700
Re: Text editor project in C Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2021-04-26 17:08 -0600
Re: Text editor project in C Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2021-04-26 16:57 -0700
Re: Text editor project in C Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2021-04-26 21:42 -0600
Re: Text editor project in C Kaz Kylheku <563-365-8930@kylheku.com> - 2021-04-27 00:46 +0000
Re: Text editor project in C Juha Nieminen <nospam@thanks.invalid> - 2021-04-27 04:51 +0000
Re: Text editor project in C Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2021-04-27 10:03 -0600
Re: Text editor project in C Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2021-04-27 09:20 -0700
Re: Text editor project in C scott@slp53.sl.home (Scott Lurndal) - 2021-04-27 16:34 +0000
Re: Text editor project in C Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2021-04-27 10:55 -0600
Re: Text editor project in C Kaz Kylheku <563-365-8930@kylheku.com> - 2021-04-27 17:13 +0000
Re: Text editor project in C Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2021-04-27 17:28 +0000
Re: Text editor project in C Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2021-04-27 13:33 -0700
Re: Text editor project in C scott@slp53.sl.home (Scott Lurndal) - 2021-04-27 19:27 +0000
Re: Text editor project in C Kaz Kylheku <563-365-8930@kylheku.com> - 2021-04-27 17:11 +0000
Re: Text editor project in C scott@slp53.sl.home (Scott Lurndal) - 2021-04-27 14:28 +0000
Re: Text editor project in C Juha Nieminen <nospam@thanks.invalid> - 2021-04-27 15:11 +0000
Re: Text editor project in C Ben Bacarisse <ben.usenet@bsb.me.uk> - 2021-04-26 21:37 +0100
Re: Text editor project in C jacobnavia <jacob@jacob.remcomp.fr> - 2021-04-26 22:48 +0200
Re: Text editor project in C scott@slp53.sl.home (Scott Lurndal) - 2021-04-26 21:53 +0000
Re: Text editor project in C Ben Bacarisse <ben.usenet@bsb.me.uk> - 2021-04-27 01:34 +0100
Re: Text editor project in C Guillaume <message@bottle.org> - 2021-04-26 18:48 +0200
Re: Text editor project in C James Kuyper <jameskuyper@alumni.caltech.edu> - 2021-04-26 13:54 -0400
Re: Text editor project in C Jorgen Grahn <grahn+nntp@snipabacken.se> - 2021-04-23 20:00 +0000
Re: Text editor project in C Juha Nieminen <nospam@thanks.invalid> - 2021-04-26 05:29 +0000
Re: Text editor project in C om@iki.fi (Otto J. Makela) - 2021-04-23 19:25 +0300
Re: Text editor project in C wij <wyniijj@gmail.com> - 2021-04-24 10:55 -0700
Re: Text editor project in C Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2021-04-24 14:21 -0700
Re: Text editor project in C Bonita Montero <Bonita.Montero@gmail.com> - 2021-04-26 18:04 +0200
Page 2 of 5 — ← Prev page 1 [2] 3 4 5 Next page →
| From | Manfred <noname@add.invalid> |
|---|---|
| Date | 2021-04-28 14:54 +0200 |
| Message-ID | <s6blt8$1n3p$1@gioia.aioe.org> |
| In reply to | #79346 |
On 4/28/2021 9:01 AM, David Brown wrote: > On 27/04/2021 18:31, jacobnavia wrote: >> Le 25/04/2021 à 15:19, Öö Tiib a écrit : >>> I do not see that point ... What companies want to reduce C++ by using >>> more COBOL, >>> FORTRAN, Ada, D or C? Can anyone point at such companies? Any cite? >> >> Look. C is the most popular programming language, according to the TIOBE >> index >> >> https://www.tiobe.com/tiobe-index/ >> >> SOME companies must be using it, don't you think so? >> >> C++ comes 4th. > > The TIOBE index is well-known for being no more than a vague indication > of the popularity of a language - it is certainly not the ranking some > people would believe. > > But let us assume that C is significantly more used than C++ - it is not > an unreasonable assumption, regardless of TIOBE. > > The question asked was "what companies want to reduce C++ by using more > C?" It was not "what companies use C?". > > In my experience, companies and developers sometimes move from C to C++. > They rarely move back. But if you know differently, tell us. > Agreed that the TIOBE index should be taken with a grain of salt (possibly even with a few pounds of it) However, the /trend/ shows that C is raising as of recent, unlike C++ - while in the long run C++ shows a more significant decrease, vs C being pretty much stable. If this were a /usage/ index it would tell something about your point - the fact still is that TIOBE is a popularity index, it measures how much people /talk/ about some programming language, which is hardly coupled with any actual professional usage, IMHO (I'm no expert in marketing/social research).
[toc] | [prev] | [next] | [standalone]
| From | Juha Nieminen <nospam@thanks.invalid> |
|---|---|
| Date | 2021-04-29 04:47 +0000 |
| Message-ID | <s6ddoo$19ag$2@gioia.aioe.org> |
| In reply to | #79350 |
Manfred <noname@add.invalid> wrote: > Agreed that the TIOBE index should be taken with a grain of salt Isn't it mainly based on how much people ask questions in forums about the language in question? If that's so, then maybe the index shouldn't be interpreted as how popular the language is, but how many questions it raises when people try to use it.
[toc] | [prev] | [next] | [standalone]
| From | Paavo Helde <myfirstname@osa.pri.ee> |
|---|---|
| Date | 2021-04-29 11:42 +0300 |
| Message-ID | <s6drik$roa$1@dont-email.me> |
| In reply to | #79361 |
29.04.2021 07:47 Juha Nieminen kirjutas: > Manfred <noname@add.invalid> wrote: >> Agreed that the TIOBE index should be taken with a grain of salt > > Isn't it mainly based on how much people ask questions in forums about > the language in question? > > If that's so, then maybe the index shouldn't be interpreted as how > popular the language is, but how many questions it raises when people > try to use it. Some of my recent programming related google searches: man recv man send man setsockopt man wcsncmp man fileno man ftello64 man fabs man scanf std::deque c++ inline variable So I can easily see how someone might mistakenly consider me a C programmer. One of my frequent questions about C functions is what the correct include header is, these are sometimes quite chaotic, but one must get them correct when e.g. moving around some existing code.
[toc] | [prev] | [next] | [standalone]
| From | Christian Gollwitzer <auriocus@gmx.de> |
|---|---|
| Date | 2021-04-29 23:04 +0200 |
| Message-ID | <s6f70l$2cc$1@dont-email.me> |
| In reply to | #79363 |
Am 29.04.21 um 10:42 schrieb Paavo Helde: > 29.04.2021 07:47 Juha Nieminen kirjutas: >> Manfred <noname@add.invalid> wrote: >>> Agreed that the TIOBE index should be taken with a grain of salt >> >> Isn't it mainly based on how much people ask questions in forums about >> the language in question? >> >> If that's so, then maybe the index shouldn't be interpreted as how >> popular the language is, but how many questions it raises when people >> try to use it. > > Some of my recent programming related google searches: > > man recv > man send > man setsockopt > man wcsncmp > man fileno > man ftello64 > man fabs > man scanf > std::deque > c++ inline variable > > So I can easily see how someone might mistakenly consider me a C > programmer. This is not how TIOBE works. They run searches on Google and other search engines with the name of the programming language and count the hits: https://www.tiobe.com/tiobe-index/programming-languages-definition/ If you run a google search yourself for scanf, that doesn't influence TIOBE at all, not even if you post a question about scanf to stackoverflow, unless you (or someone else) also mentions "C" or "C++" on the same page. So yes, it is true, the more questions a language raises, the more you'll find pages referencing it, but also the more people use it, the more will be questions.... it is definitely not a tool to run a competition between the second and third place - that is rather arbitrary. But you can be sure that a language on the 25th place (Prolog) is used less than one from the 3rd place (Python) - though in this realm, you'll find languages like Bash at the 42nd place. Bash is definitely a language without which the world would be a different place, yet people dont write that much LOC in it and therefore pose fewer questions - hence, TIOBE place doesn't equal importance. Concerning C and C++, the situation is especially bad, because many search engines cannot really distinguish between those two, let alone the users always post the correct term - some refer to C++ simply as C (as opposed to Python, e.g.). Therefore, TIOBE tells practically nothing if C or C++ is more commonly used. A similar ranking with maybe more sound methodology is this: https://madnight.github.io/githut/#/pull_requests/2021/1 It's counting the number of pull requests on Github. I'm inclinded to believe this more than TIOBE overall. But that is only my gut feeling. Christian
[toc] | [prev] | [next] | [standalone]
| From | Juha Nieminen <nospam@thanks.invalid> |
|---|---|
| Date | 2021-04-23 07:55 +0000 |
| Message-ID | <s5tuh0$1daj$1@gioia.aioe.org> |
| In reply to | #79175 |
In comp.lang.c++ jacobnavia <jacob@jacob.remcomp.fr> wrote: > Attached is the source code for the 10th edition of Unix of the "ed" > text editor, published by Brian Kernighan for his CS classes at > Princeton in 2001. Maybe it has significant historic value, but as a C program I don't think it's that great. It's quite hard to decipher (especially since it follows the typical 70's and 80's C style of using very short cryptic names everywhere), but it appears to me that it has a fixed maximum line length of 4096. I would guess you just can't edit lines longer than that. (I also love how the program has one malloc() and no corresponding free(), because why would it. It's not like it matters by the end of the program...)
[toc] | [prev] | [next] | [standalone]
| From | jacobnavia <jacob@jacob.remcomp.fr> |
|---|---|
| Date | 2021-04-23 11:25 +0200 |
| Message-ID | <s5u3pk$n6j$1@dont-email.me> |
| In reply to | #79190 |
Le 23/04/2021 à 09:55, Juha Nieminen a écrit : > (I also love how the program has one malloc() and no corresponding > free(), because why would it. It's not like it matters by the end > of the program...) If you look a bit longer, maybe you find out why, but maybe not, depends on how far you can look.
[toc] | [prev] | [next] | [standalone]
| From | "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> |
|---|---|
| Date | 2021-04-23 12:45 -0700 |
| Message-ID | <s5v84l$1ess$4@gioia.aioe.org> |
| In reply to | #79193 |
On 4/23/2021 2:25 AM, jacobnavia wrote:
> Le 23/04/2021 à 09:55, Juha Nieminen a écrit :
>> (I also love how the program has one malloc() and no corresponding
>> free(), because why would it. It's not like it matters by the end
>> of the program...)
>
> If you look a bit longer, maybe you find out why, but maybe not, depends
> on how far you can look.
for (;;)
{
struct node* = malloc(sizeof(*node));
}
Hey man, like, don't worry... The GC is there to save us! ;^o
[toc] | [prev] | [next] | [standalone]
| From | jacobnavia <jacob@jacob.remcomp.fr> |
|---|---|
| Date | 2021-04-23 22:29 +0200 |
| Message-ID | <s5vamh$jcp$1@dont-email.me> |
| In reply to | #79210 |
Le 23/04/2021 à 21:45, Chris M. Thomasson a écrit :
> On 4/23/2021 2:25 AM, jacobnavia wrote:
>> Le 23/04/2021 à 09:55, Juha Nieminen a écrit :
>>> (I also love how the program has one malloc() and no corresponding
>>> free(), because why would it. It's not like it matters by the end
>>> of the program...)
>>
>> If you look a bit longer, maybe you find out why, but maybe not,
>> depends on how far you can look.
>
> for (;;)
> {
> struct node* = malloc(sizeof(*node));
> }
>
> Hey man, like, don't worry... The GC is there to save us! ;^o
The malloc allocates the working area of the editor. It is not freed
because it will be always needed; it is realloc'ed when needed, and
freed by the OS when the program terminates. This is abvious for anyone
reading C.
[toc] | [prev] | [next] | [standalone]
| From | "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> |
|---|---|
| Date | 2021-04-23 13:34 -0700 |
| Message-ID | <s5vb0u$u6v$1@gioia.aioe.org> |
| In reply to | #79213 |
On 4/23/2021 1:29 PM, jacobnavia wrote:
> Le 23/04/2021 à 21:45, Chris M. Thomasson a écrit :
>> On 4/23/2021 2:25 AM, jacobnavia wrote:
>>> Le 23/04/2021 à 09:55, Juha Nieminen a écrit :
>>>> (I also love how the program has one malloc() and no corresponding
>>>> free(), because why would it. It's not like it matters by the end
>>>> of the program...)
>>>
>>> If you look a bit longer, maybe you find out why, but maybe not,
>>> depends on how far you can look.
>>
>> for (;;)
>> {
>> struct node* = malloc(sizeof(*node));
>> }
>>
>> Hey man, like, don't worry... The GC is there to save us! ;^o
>
> The malloc allocates the working area of the editor. It is not freed
> because it will be always needed; it is realloc'ed when needed, and
> freed by the OS when the program terminates. This is abvious for anyone
> reading C.
>
Oh wow. Don't tell me you are one of those people who think that free()
should not exist? I have dealt with them before.
[toc] | [prev] | [next] | [standalone]
| From | "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> |
|---|---|
| Date | 2021-04-23 13:37 -0700 |
| Message-ID | <s5vb5a$u6v$2@gioia.aioe.org> |
| In reply to | #79214 |
On 4/23/2021 1:34 PM, Chris M. Thomasson wrote:
> On 4/23/2021 1:29 PM, jacobnavia wrote:
>> Le 23/04/2021 à 21:45, Chris M. Thomasson a écrit :
>>> On 4/23/2021 2:25 AM, jacobnavia wrote:
>>>> Le 23/04/2021 à 09:55, Juha Nieminen a écrit :
>>>>> (I also love how the program has one malloc() and no corresponding
>>>>> free(), because why would it. It's not like it matters by the end
>>>>> of the program...)
>>>>
>>>> If you look a bit longer, maybe you find out why, but maybe not,
>>>> depends on how far you can look.
>>>
>>> for (;;)
>>> {
>>> struct node* = malloc(sizeof(*node));
>>> }
>>>
>>> Hey man, like, don't worry... The GC is there to save us! ;^o
>>
>> The malloc allocates the working area of the editor. It is not freed
>> because it will be always needed; it is realloc'ed when needed, and
>> freed by the OS when the program terminates. This is abvious for
>> anyone reading C.
>>
>
> Oh wow. Don't tell me you are one of those people who think that free()
> should not exist? I have dealt with them before.
Question from user: Why does my memory grow out of control?
Answer: Don't worry man.
wow. I have seen systems grind to a halt because of such things.
[toc] | [prev] | [next] | [standalone]
| From | jacobnavia <jacob@jacob.remcomp.fr> |
|---|---|
| Date | 2021-04-23 22:40 +0200 |
| Message-ID | <s5vbc8$n3o$2@dont-email.me> |
| In reply to | #79214 |
Le 23/04/2021 à 22:34, Chris M. Thomasson a écrit :
> On 4/23/2021 1:29 PM, jacobnavia wrote:
>> Le 23/04/2021 à 21:45, Chris M. Thomasson a écrit :
>>> On 4/23/2021 2:25 AM, jacobnavia wrote:
>>>> Le 23/04/2021 à 09:55, Juha Nieminen a écrit :
>>>>> (I also love how the program has one malloc() and no corresponding
>>>>> free(), because why would it. It's not like it matters by the end
>>>>> of the program...)
>>>>
>>>> If you look a bit longer, maybe you find out why, but maybe not,
>>>> depends on how far you can look.
>>>
>>> for (;;)
>>> {
>>> struct node* = malloc(sizeof(*node));
>>> }
>>>
>>> Hey man, like, don't worry... The GC is there to save us! ;^o
>>
>> The malloc allocates the working area of the editor. It is not freed
>> because it will be always needed; it is realloc'ed when needed, and
>> freed by the OS when the program terminates. This is abvious for
>> anyone reading C.
>>
>
> Oh wow. Don't tell me you are one of those people who think that free()
> should not exist? I have dealt with them before.
?????
Where did I said something like that?
Nowhere. You are just putting words in my mouth.
I explained to you why the code doesn't bother to free the memorysince
it is used for the whole time that the editor is running. Freeing it
just before exiting the program makes no sense.
[toc] | [prev] | [next] | [standalone]
| From | "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> |
|---|---|
| Date | 2021-04-23 13:51 -0700 |
| Message-ID | <s5vc0v$1d1c$1@gioia.aioe.org> |
| In reply to | #79218 |
On 4/23/2021 1:40 PM, jacobnavia wrote:
> Le 23/04/2021 à 22:34, Chris M. Thomasson a écrit :
>> On 4/23/2021 1:29 PM, jacobnavia wrote:
>>> Le 23/04/2021 à 21:45, Chris M. Thomasson a écrit :
>>>> On 4/23/2021 2:25 AM, jacobnavia wrote:
>>>>> Le 23/04/2021 à 09:55, Juha Nieminen a écrit :
>>>>>> (I also love how the program has one malloc() and no corresponding
>>>>>> free(), because why would it. It's not like it matters by the end
>>>>>> of the program...)
>>>>>
>>>>> If you look a bit longer, maybe you find out why, but maybe not,
>>>>> depends on how far you can look.
>>>>
>>>> for (;;)
>>>> {
>>>> struct node* = malloc(sizeof(*node));
>>>> }
>>>>
>>>> Hey man, like, don't worry... The GC is there to save us! ;^o
>>>
>>> The malloc allocates the working area of the editor. It is not freed
>>> because it will be always needed; it is realloc'ed when needed, and
>>> freed by the OS when the program terminates. This is abvious for
>>> anyone reading C.
>>>
>>
>> Oh wow. Don't tell me you are one of those people who think that
>> free() should not exist? I have dealt with them before.
>
> ?????
> Where did I said something like that?
>
> Nowhere. You are just putting words in my mouth.
I was worrying that you might be one of those types.
>
> I explained to you why the code doesn't bother to free the memorysince
> it is used for the whole time that the editor is running. Freeing it
> just before exiting the program makes no sense.
>
Why? Did you create the system its running on?
[toc] | [prev] | [next] | [standalone]
| From | "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> |
|---|---|
| Date | 2021-04-23 13:55 -0700 |
| Message-ID | <s5vc7o$1d1c$2@gioia.aioe.org> |
| In reply to | #79220 |
On 4/23/2021 1:51 PM, Chris M. Thomasson wrote:
> On 4/23/2021 1:40 PM, jacobnavia wrote:
>> Le 23/04/2021 à 22:34, Chris M. Thomasson a écrit :
>>> On 4/23/2021 1:29 PM, jacobnavia wrote:
>>>> Le 23/04/2021 à 21:45, Chris M. Thomasson a écrit :
>>>>> On 4/23/2021 2:25 AM, jacobnavia wrote:
>>>>>> Le 23/04/2021 à 09:55, Juha Nieminen a écrit :
>>>>>>> (I also love how the program has one malloc() and no corresponding
>>>>>>> free(), because why would it. It's not like it matters by the end
>>>>>>> of the program...)
>>>>>>
>>>>>> If you look a bit longer, maybe you find out why, but maybe not,
>>>>>> depends on how far you can look.
>>>>>
>>>>> for (;;)
>>>>> {
>>>>> struct node* = malloc(sizeof(*node));
>>>>> }
>>>>>
>>>>> Hey man, like, don't worry... The GC is there to save us! ;^o
>>>>
>>>> The malloc allocates the working area of the editor. It is not freed
>>>> because it will be always needed; it is realloc'ed when needed, and
>>>> freed by the OS when the program terminates. This is abvious for
>>>> anyone reading C.
>>>>
>>>
>>> Oh wow. Don't tell me you are one of those people who think that
>>> free() should not exist? I have dealt with them before.
>>
>> ?????
>> Where did I said something like that?
>>
>> Nowhere. You are just putting words in my mouth.
>
> I was worrying that you might be one of those types.
>
>
>>
>> I explained to you why the code doesn't bother to free the memorysince
>> it is used for the whole time that the editor is running. Freeing it
>> just before exiting the program makes no sense.
>>
>
> Why? Did you create the system its running on?
I my world, every malloc shall have a corresponding free. Call me a
pendant if you want. Oh well.
[toc] | [prev] | [next] | [standalone]
| From | jacobnavia <jacob@jacob.remcomp.fr> |
|---|---|
| Date | 2021-04-23 23:02 +0200 |
| Message-ID | <s5vckd$187$1@dont-email.me> |
| In reply to | #79220 |
Le 23/04/2021 à 22:51, Chris M. Thomasson a écrit :
> On 4/23/2021 1:40 PM, jacobnavia wrote:
>>
>> I explained to you why the code doesn't bother to free the memorysince
>> it is used for the whole time that the editor is running. Freeing it
>> just before exiting the program makes no sense.
>>
>
> Why? Did you create the system its running on?
The code is for the 10th edition of the UNIX system, and was around
probably since the start of UNIX.
Within the UNIX system, the OS frees all memory and ressources from a
program that terminates. No, I did not create UNIX, but maybe you should
study it a bit. It is a great system.
macpro: jacobnavia ~/ man ed
[snip]
HISTORY
An ed command appeared in Version 1 AT&T UNIX.
[toc] | [prev] | [next] | [standalone]
| From | "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> |
|---|---|
| Date | 2021-04-23 14:13 -0700 |
| Message-ID | <s5vd9u$1um1$1@gioia.aioe.org> |
| In reply to | #79223 |
On 4/23/2021 2:02 PM, jacobnavia wrote: > Le 23/04/2021 à 22:51, Chris M. Thomasson a écrit : >> On 4/23/2021 1:40 PM, jacobnavia wrote: > >>> >>> I explained to you why the code doesn't bother to free the >>> memorysince it is used for the whole time that the editor is running. >>> Freeing it just before exiting the program makes no sense. >>> >> >> Why? Did you create the system its running on? > > The code is for the 10th edition of the UNIX system, and was around > probably since the start of UNIX. > > Within the UNIX system, the OS frees all memory and ressources from a > program that terminates. No, I did not create UNIX, but maybe you should > study it a bit. It is a great system. I know exactly what you are talking about. However, please clean up after yourself? Pretty please? UNIX is not the only system out there. This is a bad habit to get into. Clean up, gosh darn it. > > macpro: jacobnavia ~/ man ed > > [snip] > > HISTORY > An ed command appeared in Version 1 AT&T UNIX.
[toc] | [prev] | [next] | [standalone]
| From | "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> |
|---|---|
| Date | 2021-04-23 15:39 -0700 |
| Message-ID | <s5viaf$1pn6$3@gioia.aioe.org> |
| In reply to | #79224 |
On 4/23/2021 2:13 PM, Chris M. Thomasson wrote: > On 4/23/2021 2:02 PM, jacobnavia wrote: >> Le 23/04/2021 à 22:51, Chris M. Thomasson a écrit : >>> On 4/23/2021 1:40 PM, jacobnavia wrote: >> >>>> >>>> I explained to you why the code doesn't bother to free the >>>> memorysince it is used for the whole time that the editor is >>>> running. Freeing it just before exiting the program makes no sense. >>>> >>> >>> Why? Did you create the system its running on? >> >> The code is for the 10th edition of the UNIX system, and was around >> probably since the start of UNIX. >> >> Within the UNIX system, the OS frees all memory and ressources from a >> program that terminates. No, I did not create UNIX, but maybe you >> should study it a bit. It is a great system. > > I know exactly what you are talking about. However, please clean up > after yourself? Pretty please? UNIX is not the only system out there. > This is a bad habit to get into. Clean up, gosh darn it. Ack! I missed the part where you were explicitly referencing the ed code in question. Sorry! Ouch. > >> >> macpro: jacobnavia ~/ man ed >> >> [snip] >> >> HISTORY >> An ed command appeared in Version 1 AT&T UNIX. >
[toc] | [prev] | [next] | [standalone]
| From | Bart <bc@freeuk.com> |
|---|---|
| Date | 2021-04-24 01:20 +0100 |
| Message-ID | <ZuJgI.149711$F197.34385@fx07.ams4> |
| In reply to | #79224 |
On 23/04/2021 22:13, Chris M. Thomasson wrote: > On 4/23/2021 2:02 PM, jacobnavia wrote: >> Le 23/04/2021 à 22:51, Chris M. Thomasson a écrit : >>> On 4/23/2021 1:40 PM, jacobnavia wrote: >> >>>> >>>> I explained to you why the code doesn't bother to free the >>>> memorysince it is used for the whole time that the editor is >>>> running. Freeing it just before exiting the program makes no sense. >>>> >>> >>> Why? Did you create the system its running on? >> >> The code is for the 10th edition of the UNIX system, and was around >> probably since the start of UNIX. >> >> Within the UNIX system, the OS frees all memory and ressources from a >> program that terminates. No, I did not create UNIX, but maybe you >> should study it a bit. It is a great system. > > I know exactly what you are talking about. However, please clean up > after yourself? Pretty please? UNIX is not the only system out there. > This is a bad habit to get into. Clean up, gosh darn it. Which OSes don't free the resources of an application that's just terminated? What happens if the app crashes before it manages to free them? What about resources such as screen window handles, bitmaps, dynamic libraries,.... ? How about the memory that that the process itself takes up for its own code, or its stack; how is an application supposed to free that? Isn't this exacly what an OS is supposed to do?
[toc] | [prev] | [next] | [standalone]
| From | "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> |
|---|---|
| Date | 2021-04-23 17:43 -0700 |
| Message-ID | <s5vpiq$f6m$1@gioia.aioe.org> |
| In reply to | #79233 |
On 4/23/2021 5:20 PM, Bart wrote: > On 23/04/2021 22:13, Chris M. Thomasson wrote: >> On 4/23/2021 2:02 PM, jacobnavia wrote: >>> Le 23/04/2021 à 22:51, Chris M. Thomasson a écrit : >>>> On 4/23/2021 1:40 PM, jacobnavia wrote: >>> >>>>> >>>>> I explained to you why the code doesn't bother to free the >>>>> memorysince it is used for the whole time that the editor is >>>>> running. Freeing it just before exiting the program makes no sense. >>>>> >>>> >>>> Why? Did you create the system its running on? >>> >>> The code is for the 10th edition of the UNIX system, and was around >>> probably since the start of UNIX. >>> >>> Within the UNIX system, the OS frees all memory and ressources from a >>> program that terminates. No, I did not create UNIX, but maybe you >>> should study it a bit. It is a great system. >> >> I know exactly what you are talking about. However, please clean up >> after yourself? Pretty please? UNIX is not the only system out there. >> This is a bad habit to get into. Clean up, gosh darn it. > > Which OSes don't free the resources of an application that's just > terminated? I cannot remember if named win3d mutex/semaphore/event/ect are automatically cleaned up... I think there could be an issue with SYSV shared memory. Iirc, some device drivers. I need to do more research. However, cleaning up after yourself is a good habit to get into. Afaict, the OS cleans up to help prevent badly written code from bringing the system down? A nit pick, but I can also think of leaking disk space wrt a program creating a temporary file with a random name or something, then forgetting to delete it. The OS is not going to automatically delete the file. Forgetting to unlock a robust mutex can be interesting, think of locking it as acquiring a resource, and unlocking as releasing it. It can cause a robust mutex to go into an abandoned state. Try to avoid that as much as possible. WAIT_ABANDONED or EOWNERDEAD should be minimized. > > What happens if the app crashes before it manages to free them? > > What about resources such as screen window handles, bitmaps, dynamic > libraries,.... ? > > How about the memory that that the process itself takes up for its own > code, or its stack; how is an application supposed to free that? > > > Isn't this exacly what an OS is supposed to do? Depends on the system your are using. Well, its better to clean up after yourself.
[toc] | [prev] | [next] | [standalone]
| From | kegs@provalid.com (Kent Dickey) |
|---|---|
| Date | 2021-04-25 00:04 -0500 |
| Message-ID | <baWdnYboN_HlZRn9nZ2dnUU7-anNnZ2d@giganews.com> |
| In reply to | #79224 |
In article <s5vd9u$1um1$1@gioia.aioe.org>, Chris M. Thomasson <chris.m.thomasson.1@gmail.com> wrote: >On 4/23/2021 2:02 PM, jacobnavia wrote: >> Le 23/04/2021 à 22:51, Chris M. Thomasson a écrit : >>> On 4/23/2021 1:40 PM, jacobnavia wrote: >>>> I explained to you why the code doesn't bother to free the >>>> memorysince it is used for the whole time that the editor is running. >>>> Freeing it just before exiting the program makes no sense. [ snip] >I know exactly what you are talking about. However, please clean up >after yourself? Pretty please? UNIX is not the only system out there. >This is a bad habit to get into. Clean up, gosh darn it. First: Programs do need to erase any temp files and free any shared resources. I wouldn't have really cared about matching malloc()/free() as an issue, but I have a problem with a program trying to free() all of its memory when qutting that is causing a problem itself. 1) It allocates shared memory segments. If they already exist, an error is printed which does not in any way explain the problem. 2) It does millions of malloc()'s (or their equivalent, like many programs now, it's written in at least 4 languages). 3) I try to exit the program. 4) While walking it's crazy internal structures, to simply call free(), it finds an inconsistency and immediately exits. 5) It forgets to free the shared memory segments since that would be done after the consistency check. If you try to re-run the program now, it may fail due to the shared memory segments still existing. The problem is at no point does the code really care about these internal consistency checks--except when it wants to exit. And it's deemed not a real problem since the program does exit (with an error code). If the code simply freed the shared memory segments and did exit(0), and didn't try to balance malloc() and free(), it would just work. There's a great deal of complexity unwinding complex malloc() chains, and why bother debugging that mess? Yes, memory leaks are bad, but allocations that will never be freed are not a problem. Every OS (even trivial ones) can handle programs not calling free() when the program exits. Kent
[toc] | [prev] | [next] | [standalone]
| From | "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> |
|---|---|
| Date | 2021-04-24 22:29 -0700 |
| Message-ID | <s62uok$gva$1@gioia.aioe.org> |
| In reply to | #79246 |
On 4/24/2021 10:04 PM, Kent Dickey wrote: > In article <s5vd9u$1um1$1@gioia.aioe.org>, > Chris M. Thomasson <chris.m.thomasson.1@gmail.com> wrote: >> On 4/23/2021 2:02 PM, jacobnavia wrote: >>> Le 23/04/2021 à 22:51, Chris M. Thomasson a écrit : >>>> On 4/23/2021 1:40 PM, jacobnavia wrote: >>>>> I explained to you why the code doesn't bother to free the >>>>> memorysince it is used for the whole time that the editor is running. >>>>> Freeing it just before exiting the program makes no sense. > > [ snip] > >> I know exactly what you are talking about. However, please clean up >> after yourself? Pretty please? UNIX is not the only system out there. >> This is a bad habit to get into. Clean up, gosh darn it. > > First: Programs do need to erase any temp files and free any shared > resources. > > I wouldn't have really cared about matching malloc()/free() as an issue, but > I have a problem with a program trying to free() all of its memory when > qutting that is causing a problem itself. > > 1) It allocates shared memory segments. If they already exist, an error is > printed which does not in any way explain the problem. > 2) It does millions of malloc()'s (or their equivalent, like many programs now, > it's written in at least 4 languages). > 3) I try to exit the program. > 4) While walking it's crazy internal structures, to simply call free(), it > finds an inconsistency and immediately exits. > 5) It forgets to free the shared memory segments since that would be done > after the consistency check. > > If you try to re-run the program now, it may fail due to the shared memory > segments still existing. > > The problem is at no point does the code really care about these internal > consistency checks--except when it wants to exit. And it's deemed not a > real problem since the program does exit (with an error code). > > If the code simply freed the shared memory segments and did exit(0), and > didn't try to balance malloc() and free(), it would just work. Actually, I am quite fond of region allocators, where there is no need to balance between allocating and flushing a region. I wrote one a while back: https://groups.google.com/g/comp.lang.c/c/7oaJFWKVCTw/m/sSWYU9BUS_QJ https://pastebin.com/raw/f37a23918 I used it in various ways, even partitioning it to allow for "partial" region resets. This is using a nasty hack, to get alignment. But, shit happens. ;^o Layering a malloc/free on top of a region allocator can sometimes allow for the free function to be a no-op. > There's a great deal of complexity unwinding complex malloc() chains, and > why bother debugging that mess? Yes, memory leaks are bad, but allocations > that will never be freed are not a problem. Every OS (even trivial ones) > can handle programs not calling free() when the program exits. Still, if you are running any type of "event" loop, memory leaks can be a problem. I had to debug a horrible one where a subtle race-condition caused memory leaks over time. The horrible nature of it was the race condition would only trip at basically random times. Speaking of random, for fun, check out the random number generator thing I wrote that is based on race conditions: https://groups.google.com/g/comp.lang.c++/c/7u_rLgQe86k/m/XiqELOEECAAJ lol. ;^)
[toc] | [prev] | [next] | [standalone]
Page 2 of 5 — ← Prev page 1 [2] 3 4 5 Next page →
Back to top | Article view | comp.lang.c++
csiph-web