Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c > #147558 > unrolled thread
| Started by | DFS <nospam@dfs.com> |
|---|---|
| First post | 2019-11-03 17:39 -0500 |
| Last post | 2019-11-09 02:09 -0500 |
| Articles | 12 on this page of 112 — 21 participants |
Back to article view | Back to comp.lang.c
One works, the other doesn't? DFS <nospam@dfs.com> - 2019-11-03 17:39 -0500
Re: One works, the other doesn't? Bart <bc@freeuk.com> - 2019-11-04 00:20 +0000
Re: One works, the other doesn't? Jorgen Grahn <grahn+nntp@snipabacken.se> - 2019-11-04 06:53 +0000
Re: One works, the other doesn't? James Kuyper <jameskuyper@alumni.caltech.edu> - 2019-11-04 09:45 -0500
Re: One works, the other doesn't? DFS <nospam@dfs.com> - 2019-11-05 10:34 -0500
Re: One works, the other doesn't? mark.bluemel@gmail.com - 2019-11-05 07:45 -0800
Re: One works, the other doesn't? DFS <nospam@dfs.com> - 2019-11-05 10:53 -0500
Re: One works, the other doesn't? Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2019-11-05 08:04 -0800
Re: One works, the other doesn't? DFS <nospam@dfs.com> - 2019-11-05 11:29 -0500
Re: One works, the other doesn't? David Brown <david.brown@hesbynett.no> - 2019-11-05 23:24 +0100
Re: One works, the other doesn't? Bart <bc@freeuk.com> - 2019-11-05 23:06 +0000
Re: One works, the other doesn't? Ian Collins <ian-news@hotmail.com> - 2019-11-06 12:31 +1300
Re: One works, the other doesn't? Bart <bc@freeuk.com> - 2019-11-05 23:43 +0000
Re: One works, the other doesn't? Ian Collins <ian-news@hotmail.com> - 2019-11-06 12:54 +1300
Re: One works, the other doesn't? Bart <bc@freeuk.com> - 2019-11-06 01:35 +0000
Re: One works, the other doesn't? Ian Collins <ian-news@hotmail.com> - 2019-11-06 15:16 +1300
Re: One works, the other doesn't? Bart <bc@freeuk.com> - 2019-11-06 11:11 +0000
Re: One works, the other doesn't? Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2019-11-06 01:59 -0800
Re: One works, the other doesn't? David Brown <david.brown@hesbynett.no> - 2019-11-06 11:35 +0100
Re: One works, the other doesn't? Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2019-11-06 08:57 -0800
Re: One works, the other doesn't? Ian Collins <ian-news@hotmail.com> - 2019-11-07 07:24 +1300
Re: One works, the other doesn't? David Brown <david.brown@hesbynett.no> - 2019-11-06 22:59 +0100
Re: One works, the other doesn't? Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2019-11-06 14:37 -0800
Re: One works, the other doesn't? David Brown <david.brown@hesbynett.no> - 2019-11-07 00:58 +0100
Re: One works, the other doesn't? Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2019-11-07 02:08 -0800
Re: One works, the other doesn't? David Brown <david.brown@hesbynett.no> - 2019-11-07 15:43 +0100
Re: One works, the other doesn't? Robert Wessel <robertwessel2@yahoo.com> - 2019-11-07 16:15 -0600
Re: One works, the other doesn't? Jorgen Grahn <grahn+nntp@snipabacken.se> - 2019-11-10 20:01 +0000
Re: One works, the other doesn't? Ian Collins <ian-news@hotmail.com> - 2019-11-11 15:26 +1300
Re: One works, the other doesn't? David Brown <david.brown@hesbynett.no> - 2019-11-11 12:37 +0100
Re: One works, the other doesn't? Ian Collins <ian-news@hotmail.com> - 2019-11-07 07:21 +1300
Re: One works, the other doesn't? Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2019-11-06 10:39 -0800
Re: One works, the other doesn't? Ian Collins <ian-news@hotmail.com> - 2019-11-07 07:47 +1300
Re: One works, the other doesn't? Ian Collins <ian-news@hotmail.com> - 2019-11-07 08:14 +1300
Re: One works, the other doesn't? Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2019-11-06 12:30 -0800
Re: One works, the other doesn't? Tim Rentsch <tr.17687@z991.linuxsc.com> - 2019-11-08 21:04 -0800
Re: One works, the other doesn't? "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2019-11-09 01:37 -0800
Re: One works, the other doesn't? "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2019-11-09 01:38 -0800
Re: One works, the other doesn't? Ian Collins <ian-news@hotmail.com> - 2019-11-10 08:32 +1300
Re: One works, the other doesn't? Tim Rentsch <tr.17687@z991.linuxsc.com> - 2019-11-28 16:09 -0800
Re: One works, the other doesn't? David Brown <david.brown@hesbynett.no> - 2019-11-29 11:33 +0100
Re: One works, the other doesn't? Öö Tiib <ootiib@hot.ee> - 2019-11-30 14:20 -0800
Re: One works, the other doesn't? Ian Collins <ian-news@hotmail.com> - 2019-12-01 12:15 +1300
Re: One works, the other doesn't? David Brown <david.brown@hesbynett.no> - 2019-11-06 10:07 +0100
Re: One works, the other doesn't? Bart <bc@freeuk.com> - 2019-11-06 10:58 +0000
Re: One works, the other doesn't? David Brown <david.brown@hesbynett.no> - 2019-11-07 10:05 +0100
Re: One works, the other doesn't? David Brown <david.brown@hesbynett.no> - 2019-11-06 09:52 +0100
Re: One works, the other doesn't? "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2019-11-06 00:56 -0800
Re: One works, the other doesn't? "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2019-11-06 01:00 -0800
Re: One works, the other doesn't? Bart <bc@freeuk.com> - 2019-11-06 11:32 +0000
Re: One works, the other doesn't? David Brown <david.brown@hesbynett.no> - 2019-11-06 23:11 +0100
Re: One works, the other doesn't? Bart <bc@freeuk.com> - 2019-11-06 23:22 +0000
Re: One works, the other doesn't? David Brown <david.brown@hesbynett.no> - 2019-11-07 01:04 +0100
Re: One works, the other doesn't? Bart <bc@freeuk.com> - 2019-11-07 01:13 +0000
Re: One works, the other doesn't? David Brown <david.brown@hesbynett.no> - 2019-11-07 10:22 +0100
Re: One works, the other doesn't? Bart <bc@freeuk.com> - 2019-11-07 11:51 +0000
Re: One works, the other doesn't? David Brown <david.brown@hesbynett.no> - 2019-11-07 15:58 +0100
Re: One works, the other doesn't? Bart <bc@freeuk.com> - 2019-11-07 16:34 +0000
Re: One works, the other doesn't? DFS <nospam@dfs.com> - 2019-11-07 12:40 -0500
Re: One works, the other doesn't? Bart <bc@freeuk.com> - 2019-11-07 17:57 +0000
Re: One works, the other doesn't? Keith Thompson <kst-u@mib.org> - 2019-11-07 21:14 -0800
Re: One works, the other doesn't? Bart <bc@freeuk.com> - 2019-11-08 09:45 +0000
Re: One works, the other doesn't? Keith Thompson <kst-u@mib.org> - 2019-11-08 09:56 -0800
Re: One works, the other doesn't? Bart <bc@freeuk.com> - 2019-11-08 19:47 +0000
Re: One works, the other doesn't? Ian Collins <ian-news@hotmail.com> - 2019-11-09 09:14 +1300
Re: One works, the other doesn't? Keith Thompson <kst-u@mib.org> - 2019-11-08 19:10 -0800
Re: One works, the other doesn't? Bart <bc@freeuk.com> - 2019-11-09 12:24 +0000
Like an old married couple... (Was: One works, the other doesn't?) gazelle@shell.xmission.com (Kenny McCormack) - 2019-11-08 20:25 +0000
Re: One works, the other doesn't? David Brown <david.brown@hesbynett.no> - 2019-11-07 19:58 +0100
Re: One works, the other doesn't? Bart <bc@freeuk.com> - 2019-11-07 19:31 +0000
Re: One works, the other doesn't? Ian Collins <ian-news@hotmail.com> - 2019-11-08 08:56 +1300
Re: One works, the other doesn't? Bart <bc@freeuk.com> - 2019-11-07 20:06 +0000
Re: One works, the other doesn't? Ian Collins <ian-news@hotmail.com> - 2019-11-08 09:21 +1300
Re: One works, the other doesn't? Bart <bc@freeuk.com> - 2019-11-07 21:20 +0000
Re: One works, the other doesn't? Ian Collins <ian-news@hotmail.com> - 2019-11-08 10:28 +1300
Re: One works, the other doesn't? Bart <bc@freeuk.com> - 2019-11-07 22:35 +0000
Re: One works, the other doesn't? Ian Collins <ian-news@hotmail.com> - 2019-11-09 09:22 +1300
Re: One works, the other doesn't? jadill33@gmail.com - 2019-11-07 08:37 -0800
Re: One works, the other doesn't? Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2019-11-07 08:52 -0800
Re: One works, the other doesn't? jadill33@gmail.com - 2019-11-07 09:52 -0800
Re: One works, the other doesn't? David Brown <david.brown@hesbynett.no> - 2019-11-07 20:04 +0100
Re: One works, the other doesn't? Tim Rentsch <tr.17687@z991.linuxsc.com> - 2019-11-08 19:50 -0800
Re: One works, the other doesn't? Bonita Montero <Bonita.Montero@gmail.com> - 2019-11-05 18:05 +0100
Re: One works, the other doesn't? Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2019-11-05 09:28 -0800
Re: One works, the other doesn't? Bonita Montero <Bonita.Montero@gmail.com> - 2019-11-05 19:02 +0100
Re: One works, the other doesn't? David Brown <david.brown@hesbynett.no> - 2019-11-05 23:21 +0100
Re: One works, the other doesn't? Bonita Montero <Bonita.Montero@gmail.com> - 2019-11-06 18:36 +0100
Re: One works, the other doesn't? James Kuyper <jameskuyper@alumni.caltech.edu> - 2019-11-05 12:51 -0500
Re: One works, the other doesn't? DFS <nospam@dfs.com> - 2019-11-05 18:35 -0500
Re: One works, the other doesn't? Barry Schwarz <schwarzb@delq.com> - 2019-11-05 17:53 -0800
Re: One works, the other doesn't? James Kuyper <jameskuyper@alumni.caltech.edu> - 2019-11-06 09:33 -0500
Re: One works, the other doesn't? Barry Schwarz <schwarzb@delq.com> - 2019-11-05 13:36 -0800
Re: One works, the other doesn't? jak <nospam@please.ty> - 2019-11-07 10:17 +0100
Re: One works, the other doesn't? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2019-11-07 12:19 +0000
Re: One works, the other doesn't? jak <nospam@please.ty> - 2019-11-07 18:59 +0100
Re: One works, the other doesn't? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2019-11-08 00:02 +0000
Re: One works, the other doesn't? jak <nospam@please.ty> - 2019-11-20 10:54 +0100
Re: One works, the other doesn't? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2019-11-20 11:14 +0000
Re: One works, the other doesn't? jak <nospam@please.ty> - 2019-11-20 13:22 +0100
Re: One works, the other doesn't? Tim Rentsch <tr.17687@z991.linuxsc.com> - 2019-11-28 15:54 -0800
Re: One works, the other doesn't? Keith Thompson <kst-u@mib.org> - 2019-11-20 08:42 -0800
Re: One works, the other doesn't? Manfred <noname@add.invalid> - 2019-11-21 18:56 +0100
Re: One works, the other doesn't? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2019-11-22 01:07 +0000
Re: One works, the other doesn't? Manfred <noname@add.invalid> - 2019-11-22 15:27 +0100
Re: One works, the other doesn't? Tim Rentsch <tr.17687@z991.linuxsc.com> - 2019-11-28 15:47 -0800
Re: One works, the other doesn't? DFS <nospam@dfs.com> - 2019-11-07 18:41 -0500
Re: One works, the other doesn't? Bonita Montero <Bonita.Montero@gmail.com> - 2019-11-05 17:39 +0100
Re: One works, the other doesn't? DFS <nospam@dfs.com> - 2019-11-05 11:47 -0500
Re: One works, the other doesn't? Bonita Montero <Bonita.Montero@gmail.com> - 2019-11-05 17:54 +0100
Re: One works, the other doesn't? luser droog <luser.droog@gmail.com> - 2019-11-05 09:00 -0800
Re: One works, the other doesn't? Tim Rentsch <tr.17687@z991.linuxsc.com> - 2019-11-08 21:02 -0800
Re: One works, the other doesn't? DFS <nospam@dfs.com> - 2019-11-09 02:09 -0500
Page 6 of 6 — ← Prev page 1 2 3 4 5 [6]
| From | Keith Thompson <kst-u@mib.org> |
|---|---|
| Date | 2019-11-20 08:42 -0800 |
| Message-ID | <ln4kyy1otr.fsf@kst-u.example.com> |
| In reply to | #148071 |
Ben Bacarisse <ben.usenet@bsb.me.uk> writes:
[...]
> There's a very old trick to do the same thing:
>
> typedef struct LIST
> {
> int count;
> struct LIST *pMin, *pMaj;
> char str[1];
> } Lista;
>
> Then you over-allocate the struct and store the string in-place, so to
> speak. Of course it is technically undefined to access elements of the
> str member with indexes > 1, but it was (and is) such a widely-used hack
> that I would be surprised if any compiler did not take the possibility
> into account.
The "struct hack", as it's called, is discussed in question 2.6 of the
comp.lang.c FAQ <http://www.c-faq.com/>.
--
Keith Thompson (The_Other_Keith) kst-u@mib.org <http://www.ghoti.net/~kst>
Working, but not speaking, for Philips Healthcare
void Void(void) { Void(); } /* The recursive call of the void */
[toc] | [prev] | [next] | [standalone]
| From | Manfred <noname@add.invalid> |
|---|---|
| Date | 2019-11-21 18:56 +0100 |
| Message-ID | <qr6j3j$1511$1@gioia.aioe.org> |
| In reply to | #148079 |
On 11/20/2019 5:42 PM, Keith Thompson wrote:
> Ben Bacarisse <ben.usenet@bsb.me.uk> writes:
> [...]
>> There's a very old trick to do the same thing:
>>
>> typedef struct LIST
>> {
>> int count;
>> struct LIST *pMin, *pMaj;
>> char str[1];
>> } Lista;
>>
>> Then you over-allocate the struct and store the string in-place, so to
>> speak. Of course it is technically undefined to access elements of the
>> str member with indexes > 1, but it was (and is) such a widely-used hack
>> that I would be surprised if any compiler did not take the possibility
>> into account.
>
> The "struct hack", as it's called, is discussed in question 2.6 of the
> comp.lang.c FAQ <http://www.c-faq.com/>.
>
Wherein a reference is given to the well defined construct:
typedef struct LIST
{
int count;
struct LIST *pMin, *pMaj;
char str[];
} Lista;
[toc] | [prev] | [next] | [standalone]
| From | Ben Bacarisse <ben.usenet@bsb.me.uk> |
|---|---|
| Date | 2019-11-22 01:07 +0000 |
| Message-ID | <87h82w7m7q.fsf@bsb.me.uk> |
| In reply to | #148104 |
Manfred <noname@add.invalid> writes:
> On 11/20/2019 5:42 PM, Keith Thompson wrote:
>> Ben Bacarisse <ben.usenet@bsb.me.uk> writes:
>> [...]
>>> There's a very old trick to do the same thing:
>>>
>>> typedef struct LIST
>>> {
>>> int count;
>>> struct LIST *pMin, *pMaj;
>>> char str[1];
>>> } Lista;
>>>
>>> Then you over-allocate the struct and store the string in-place, so to
>>> speak. Of course it is technically undefined to access elements of the
>>> str member with indexes > 1, but it was (and is) such a widely-used hack
>>> that I would be surprised if any compiler did not take the possibility
>>> into account.
>>
>> The "struct hack", as it's called, is discussed in question 2.6 of the
>> comp.lang.c FAQ <http://www.c-faq.com/>.
>>
>
> Wherein a reference is given to the well defined construct:
> typedef struct LIST
> {
> int count;
> struct LIST *pMin, *pMaj;
> char str[];
> } Lista;
And, indeed, that's already been talked about up thread. We are in
danger of entering a loop with no termination condition!
--
Ben.
[toc] | [prev] | [next] | [standalone]
| From | Manfred <noname@add.invalid> |
|---|---|
| Date | 2019-11-22 15:27 +0100 |
| Message-ID | <qr8r81$1a1v$1@gioia.aioe.org> |
| In reply to | #148110 |
On 11/22/2019 2:07 AM, Ben Bacarisse wrote:
> Manfred <noname@add.invalid> writes:
>
>> On 11/20/2019 5:42 PM, Keith Thompson wrote:
>>> Ben Bacarisse <ben.usenet@bsb.me.uk> writes:
>>> [...]
>>>> There's a very old trick to do the same thing:
>>>>
>>>> typedef struct LIST
>>>> {
>>>> int count;
>>>> struct LIST *pMin, *pMaj;
>>>> char str[1];
>>>> } Lista;
>>>>
>>>> Then you over-allocate the struct and store the string in-place, so to
>>>> speak. Of course it is technically undefined to access elements of the
>>>> str member with indexes > 1, but it was (and is) such a widely-used hack
>>>> that I would be surprised if any compiler did not take the possibility
>>>> into account.
>>>
>>> The "struct hack", as it's called, is discussed in question 2.6 of the
>>> comp.lang.c FAQ <http://www.c-faq.com/>.
>>>
>>
>> Wherein a reference is given to the well defined construct:
>> typedef struct LIST
>> {
>> int count;
>> struct LIST *pMin, *pMaj;
>> char str[];
>> } Lista;
>
> And, indeed, that's already been talked about up thread. We are in
> danger of entering a loop with no termination condition!
>
True, sorry for the noise. I hadn't read upthread, and I did not realize
that the discussion was going backwards in time, from str[] to str[1].
[toc] | [prev] | [next] | [standalone]
| From | Tim Rentsch <tr.17687@z991.linuxsc.com> |
|---|---|
| Date | 2019-11-28 15:47 -0800 |
| Message-ID | <86zhgf8swn.fsf@linuxsc.com> |
| In reply to | #148068 |
jak <nospam@please.ty> writes: > Il 08/11/2019 01:02, Ben Bacarisse ha scritto: > >>> [...] >> >> A merge sort will be O(n log n) but an unbalanced tree can still be >> O(n^2). On average it will be better, but not in the worst case. > > Forgive me if I'm late. I have little free time for myself. > Now I have again changed the algorithm to a balanced AVL tree. If you have written C code for maintaining an AVL tree how about posting that?
[toc] | [prev] | [next] | [standalone]
| From | DFS <nospam@dfs.com> |
|---|---|
| Date | 2019-11-07 18:41 -0500 |
| Message-ID | <uY1xF.91732$Ys1.32568@fx42.iad> |
| In reply to | #147701 |
On 11/7/2019 4:17 AM, jak wrote: > Il 05/11/2019 16:34, DFS ha scritto: ha scritto... heh! > I'm sorry, don't you think it's better to approach it using orderly > entry lists? Not sure what you mean. I had specific things I wanted to do to arrive at a final list: - start with 2 lists of random data - add a set of values to each list (which will create dupes when the lists are combined) - combine the lists - sort the new list - dedupe the list - copy unique elements to an array of the exact size I ran your code as is (10K elements) and it worked. I ran your code for 10M elements and it segfaulted.
[toc] | [prev] | [next] | [standalone]
| From | Bonita Montero <Bonita.Montero@gmail.com> |
|---|---|
| Date | 2019-11-05 17:39 +0100 |
| Message-ID | <qps8j8$lhj$1@news.albasani.net> |
| In reply to | #147576 |
I don't know why do you think there's something to DFS. If he isn't skilled enough to manage to write something like that on his own he's a hopeless case.
[toc] | [prev] | [next] | [standalone]
| From | DFS <nospam@dfs.com> |
|---|---|
| Date | 2019-11-05 11:47 -0500 |
| Message-ID | <%KhwF.7696$522.3346@fx05.iad> |
| In reply to | #147621 |
On 11/5/2019 11:39 AM, Bonita Montero wrote: > I don't know why do you think there's something to DFS. If he isn't > skilled enough to manage to write something like that on his own > he's a hopeless case. I didn't see your suggestions or fixes, creep. Why not?
[toc] | [prev] | [next] | [standalone]
| From | Bonita Montero <Bonita.Montero@gmail.com> |
|---|---|
| Date | 2019-11-05 17:54 +0100 |
| Message-ID | <qps9ft$i7r$1@news.albasani.net> |
| In reply to | #147622 |
>> I don't know why do you think there's something to DFS. >> If he isn't skilled enough to manage to write something >> like that on his own he's a hopeless case. > I didn't see your suggestions or fixes, creep. Why not? Because it doesn't make sense for the reason I told above.
[toc] | [prev] | [next] | [standalone]
| From | luser droog <luser.droog@gmail.com> |
|---|---|
| Date | 2019-11-05 09:00 -0800 |
| Message-ID | <d5b52c78-101f-49eb-9b4e-94d84a1c3801@googlegroups.com> |
| In reply to | #147623 |
On Tuesday, November 5, 2019 at 10:54:35 AM UTC-6, Bonita Montero wrote: > >> I don't know why do you think there's something to DFS. > >> If he isn't skilled enough to manage to write something > >> like that on his own he's a hopeless case. > > > I didn't see your suggestions or fixes, creep. Why not? > > Because it doesn't make sense for the reason I told above. This is not the way members of this group usually operate. Participants here offer help almost unilaterally. Even if it may seem that OP will not benefit (which does not appear to be the case here), there are other readers who may. Your unfriendly dismissals and snap judgments do a disservice to everyone, self included.
[toc] | [prev] | [next] | [standalone]
| From | Tim Rentsch <tr.17687@z991.linuxsc.com> |
|---|---|
| Date | 2019-11-08 21:02 -0800 |
| Message-ID | <86ftixej6f.fsf@linuxsc.com> |
| In reply to | #147622 |
DFS <nospam@dfs.com> writes: > On 11/5/2019 11:39 AM, Bonita Montero wrote: > >> I don't know why do you think there's something to DFS. If he isn't >> skilled enough to manage to write something like that on his own >> he's a hopeless case. > > I didn't see your suggestions or fixes, [...] Speaking only for myself, I have a suggestion. If you show more consideration for other people in the group, other people might be more inclined to show more consideration in responding to your questions.
[toc] | [prev] | [next] | [standalone]
| From | DFS <nospam@dfs.com> |
|---|---|
| Date | 2019-11-09 02:09 -0500 |
| Message-ID | <oCtxF.6739$%o2.972@fx31.iad> |
| In reply to | #147810 |
On 11/9/2019 12:02 AM, Tim Rentsch wrote: > DFS <nospam@dfs.com> writes: > >> On 11/5/2019 11:39 AM, Bonita Montero wrote: >> >>> I don't know why do you think there's something to DFS. If he isn't >>> skilled enough to manage to write something like that on his own >>> he's a hopeless case. >> >> I didn't see your suggestions or fixes, [...] > > Speaking only for myself, I have a suggestion. If you show more > consideration for other people in the group, other people might > be more inclined to show more consideration in responding to your > questions. What are you talking about? When was I EVER inconsiderate to anyone here?
[toc] | [prev] | [standalone]
Page 6 of 6 — ← Prev page 1 2 3 4 5 [6]
Back to top | Article view | comp.lang.c
csiph-web