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


Groups > comp.lang.c > #15021 > unrolled thread

rms from rosettacode

Started bysuperpollo <superpollo@tznvy.pbz>
First post2011-12-27 11:25 +0100
Last post2011-12-28 19:11 +0000
Articles 20 on this page of 42 — 15 participants

Back to article view | Back to comp.lang.c


Contents

  rms from rosettacode superpollo <superpollo@tznvy.pbz> - 2011-12-27 11:25 +0100
    Re: rms from rosettacode James Kuyper <jameskuyper@verizon.net> - 2011-12-27 06:48 -0500
      Re: rms from rosettacode superpollo <superpollo@tznvy.pbz> - 2011-12-27 13:01 +0100
        Re: rms from rosettacode James Kuyper <jameskuyper@verizon.net> - 2011-12-27 07:10 -0500
          Re: rms from rosettacode superpollo <superpollo@tznvy.pbz> - 2011-12-27 13:36 +0100
            Re: rms from rosettacode James Kuyper <jameskuyper@verizon.net> - 2011-12-27 10:04 -0500
      Re: rms from rosettacode Keith Thompson <kst-u@mib.org> - 2011-12-27 14:42 -0800
        Re: rms from rosettacode James Kuyper <jameskuyper@verizon.net> - 2011-12-27 18:46 -0500
    Re: rms from rosettacode 88888 Dihedral <dihedral88888@googlemail.com> - 2011-12-27 09:49 -0800
    Re: rms from rosettacode "BartC" <bc@freeuk.com> - 2011-12-27 18:14 +0000
      Re: rms from rosettacode superpollo <superpollo@tznvy.pbz> - 2011-12-27 19:33 +0100
        Re: rms from rosettacode jt@toerring.de (Jens Thoms Toerring) - 2011-12-27 19:04 +0000
          Re: rms from rosettacode Keith Thompson <kst-u@mib.org> - 2011-12-27 14:45 -0800
          Re: rms from rosettacode blp@cs.stanford.edu (Ben Pfaff) - 2011-12-27 14:57 -0800
        Re: rms from rosettacode "BartC" <bc@freeuk.com> - 2011-12-27 19:06 +0000
          Re: rms from rosettacode Bull in a China Blue Shop <chine.bleu@yahoo.com> - 2011-12-27 16:16 -0800
        Re: rms from rosettacode James Kuyper <jameskuyper@verizon.net> - 2011-12-27 14:11 -0500
        Re: rms from rosettacode Seebs <usenet-nospam@seebs.net> - 2011-12-27 20:13 +0000
        Re: rms from rosettacode Johann Klammer <klammerr@NOSPAM.aon.at> - 2011-12-28 00:23 +0100
        Re: rms from rosettacode 88888 Dihedral <dihedral88888@googlemail.com> - 2011-12-27 15:54 -0800
          Re: rms from rosettacode Keith Thompson <kst-u@mib.org> - 2011-12-27 22:53 -0800
            Re: rms from rosettacode Seebs <usenet-nospam@seebs.net> - 2011-12-28 06:29 +0000
            Re: rms from rosettacode 88888 Dihedral <dihedral88888@googlemail.com> - 2011-12-28 02:45 -0800
    Re: rms from rosettacode Kaz Kylheku <kaz@kylheku.com> - 2011-12-27 19:53 +0000
      Re: rms from rosettacode Seebs <usenet-nospam@seebs.net> - 2011-12-27 20:13 +0000
      Re: rms from rosettacode superpollo <superpollo@tznvy.pbz> - 2011-12-27 21:31 +0100
        Re: rms from rosettacode Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-12-27 20:49 -0500
          Re: rms from rosettacode superpollo <superpollo@tznvy.pbz> - 2011-12-28 11:42 +0100
            Re: rms from rosettacode Nick Keighley <nick_keighley_nospam@hotmail.com> - 2011-12-29 08:18 -0800
          Re: rms from rosettacode superpollo <superpollo@tznvy.pbz> - 2011-12-28 11:54 +0100
            Re: rms from rosettacode Phil Carmody <thefatphil_demunged@yahoo.co.uk> - 2011-12-29 04:12 +0200
              Re: rms from rosettacode superpollo <superpollo@tznvy.pbz> - 2011-12-29 14:38 +0100
          Re: rms from rosettacode Nick Keighley <nick_keighley_nospam@hotmail.com> - 2011-12-28 02:26 -0800
            Re: rms from rosettacode Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-12-28 21:35 -0500
              Re: rms from rosettacode superpollo <superpollo@tznvy.pbz> - 2011-12-29 14:10 +0100
          Re: rms from rosettacode James Kuyper <jameskuyper@verizon.net> - 2011-12-28 08:03 -0500
            Re: rms from rosettacode "BartC" <bc@freeuk.com> - 2011-12-28 13:32 +0000
              Re: rms from rosettacode Dr Nick <3-nospam@temporary-address.org.uk> - 2011-12-28 13:41 +0000
              Re: rms from rosettacode Kaz Kylheku <kaz@kylheku.com> - 2011-12-28 19:29 +0000
              Re: rms from rosettacode Keith Thompson <kst-u@mib.org> - 2011-12-28 13:47 -0800
              Re: rms from rosettacode Phil Carmody <thefatphil_demunged@yahoo.co.uk> - 2011-12-29 04:19 +0200
        Re: rms from rosettacode Kaz Kylheku <kaz@kylheku.com> - 2011-12-28 19:11 +0000

Page 2 of 3 — ← Prev page 1 [2] 3  Next page →


#15074

FromKeith Thompson <kst-u@mib.org>
Date2011-12-27 22:53 -0800
Message-ID<lnvcp1yyp3.fsf@nuthaus.mib.org>
In reply to#15062
88888 Dihedral <dihedral88888@googlemail.com> writes:
> superpollo於 2011年12月28日星期三UTC+8上午2時33分51秒寫道:
[...]
>> so, to summarize: it is not possible for a function that gets an array 
>> passed to figure by herself the size, right? so the *idiomatic* way to 
>> give that info to the funtion should be that of the original rosettacode 
>> code, or is there another way?
>
> This does matter in the pass by register implementations of calling 
> a function. The rule of thumb in IA32 X86 is that 3 32bit parameters 
> to be the input parameters of a function is OK by __fastcall. 
>
>
> But for MIPS compatible CPUs, things are not the same. 

None of that has anything at all to do with the statement to which
you're responding.

Please try to pay attention.

-- 
Keith Thompson (The_Other_Keith) kst-u@mib.org  <http://www.ghoti.net/~kst>
    Will write code for food.
"We must do something.  This is something.  Therefore, we must do this."
    -- Antony Jay and Jonathan Lynn, "Yes Minister"

[toc] | [prev] | [next] | [standalone]


#15076

FromSeebs <usenet-nospam@seebs.net>
Date2011-12-28 06:29 +0000
Message-ID<slrnjflfa4.27kb.usenet-nospam@guild.seebs.net>
In reply to#15074
On 2011-12-28, Keith Thompson <kst-u@mib.org> wrote:
> None of that has anything at all to do with the statement to which
> you're responding.

I am not sure this is true, because I do not think we have compelling
evidence that the poster in question is responding to posted statements,
even if sometimes those statements are quoted.

Honestly, the more I read this, the more it looks like word salad.

-s
-- 
Copyright 2011, all wrongs reversed.  Peter Seebach / usenet-nospam@seebs.net
http://www.seebs.net/log/ <-- lawsuits, religion, and funny pictures
http://en.wikipedia.org/wiki/Fair_Game_(Scientology) <-- get educated!
I am not speaking for my employer, although they do rent some of my opinions.

[toc] | [prev] | [next] | [standalone]


#15084

From88888 Dihedral <dihedral88888@googlemail.com>
Date2011-12-28 02:45 -0800
Message-ID<20359692.1021.1325069140365.JavaMail.geo-discussion-forums@preg20>
In reply to#15074
Keith Thompson於 2011年12月28日星期三UTC+8下午2時53分12秒寫道:
> 88888 Dihedral <dihedr...@googlemail.com> writes:
> > superpollo於 2011年12月28日星期三UTC+8上午2時33分51秒寫道:
> [...]
> >> so, to summarize: it is not possible for a function that gets an array 
> >> passed to figure by herself the size, right? so the *idiomatic* way to 
> >> give that info to the funtion should be that of the original rosettacode 
> >> code, or is there another way?
> >
> > This does matter in the pass by register implementations of calling 
> > a function. The rule of thumb in IA32 X86 is that 3 32bit parameters 
> > to be the input parameters of a function is OK by __fastcall. 
> >
> >
> > But for MIPS compatible CPUs, things are not the same. 
> 
> None of that has anything at all to do with the statement to which
> you're responding.
> 
> Please try to pay attention.
> 
> -- 
> Keith Thompson (The_Other_Keith) ks...@mib.org  <http://www.ghoti.net/~kst>
>     Will write code for food.
> "We must do something.  This is something.  Therefore, we must do this."
>     -- Antony Jay and Jonathan Lynn, "Yes Minister"

There is another way to call a function by passing a pointer to a structure.

Then there is the C++ way of passing an object reference to a function. 

[toc] | [prev] | [next] | [standalone]


#15038

FromKaz Kylheku <kaz@kylheku.com>
Date2011-12-27 19:53 +0000
Message-ID<20111227115244.994@kylheku.com>
In reply to#15021
On 2011-12-27, superpollo <superpollo@tznvy.pbz> wrote:
> what gives?

What gives is that you're not yet competent enough in C to be working on
Rosetta Code examples. Please find a different hobby.

[toc] | [prev] | [next] | [standalone]


#15040

FromSeebs <usenet-nospam@seebs.net>
Date2011-12-27 20:13 +0000
Message-ID<slrnjfk9gu.1ln3.usenet-nospam@guild.seebs.net>
In reply to#15038
On 2011-12-27, Kaz Kylheku <kaz@kylheku.com> wrote:
> On 2011-12-27, superpollo <superpollo@tznvy.pbz> wrote:
>> what gives?

> What gives is that you're not yet competent enough in C to be working on
> Rosetta Code examples. Please find a different hobby.

I would rather see people be in over their heads on Rosetta Code than on
medical equipment.  :)

-s
-- 
Copyright 2011, all wrongs reversed.  Peter Seebach / usenet-nospam@seebs.net
http://www.seebs.net/log/ <-- lawsuits, religion, and funny pictures
http://en.wikipedia.org/wiki/Fair_Game_(Scientology) <-- get educated!
I am not speaking for my employer, although they do rent some of my opinions.

[toc] | [prev] | [next] | [standalone]


#15042

Fromsuperpollo <superpollo@tznvy.pbz>
Date2011-12-27 21:31 +0100
Message-ID<4efa2b39$0$1383$4fafbaef@reader2.news.tin.it>
In reply to#15038
Kaz Kylheku ha scritto:
> On 2011-12-27, superpollo <superpollo@tznvy.pbz> wrote:
>> what gives?
> 
> What gives is that you're not yet competent enough in C to be working on
> Rosetta Code examples. Please find a different hobby.

thanks for your constructive criticism. a beautiful way to lure 
newcomers to the language!

bye

-- 
Chissa' perche' in un triangolo (5*5)/2=12.5
ci stanno 125 triangolini ???

[toc] | [prev] | [next] | [standalone]


#15067

FromEric Sosman <esosman@ieee-dot-org.invalid>
Date2011-12-27 20:49 -0500
Message-ID<jddska$550$1@dont-email.me>
In reply to#15042
On 12/27/2011 3:31 PM, superpollo wrote:
> Kaz Kylheku ha scritto:
>> On 2011-12-27, superpollo <superpollo@tznvy.pbz> wrote:
>>> what gives?
>>
>> What gives is that you're not yet competent enough in C to be working on
>> Rosetta Code examples. Please find a different hobby.
>
> thanks for your constructive criticism. a beautiful way to lure
> newcomers to the language!

     Especially "newcomers" who've participated in this forum since
at least June 2009.  "Newcomers" who've taken thirty or more months
to fail to find the FAQ.

     Yes, Kaz is being a bit brutal.  But I think he's being honest:
If in two and a half years you have not learned what happens when you
"pass an array" to a function, you have scant aptitude for this
particular discipline.  Other and worthier disciplines exist; go and
pursue one of those.

-- 
Eric Sosman
esosman@ieee-dot-org.invalid

[toc] | [prev] | [next] | [standalone]


#15082

Fromsuperpollo <superpollo@tznvy.pbz>
Date2011-12-28 11:42 +0100
Message-ID<4efaf288$0$1379$4fafbaef@reader2.news.tin.it>
In reply to#15067
Eric Sosman ha scritto:
> On 12/27/2011 3:31 PM, superpollo wrote:
>> Kaz Kylheku ha scritto:
>>> On 2011-12-27, superpollo <superpollo@tznvy.pbz> wrote:
>>>> what gives?
>>>
>>> What gives is that you're not yet competent enough in C to be working on
>>> Rosetta Code examples. Please find a different hobby.
>>
>> thanks for your constructive criticism. a beautiful way to lure
>> newcomers to the language!
> 
>     Especially "newcomers" who've participated in this forum since
> at least June 2009.  "Newcomers" who've taken thirty or more months
> to fail to find the FAQ.
> 
>     Yes, Kaz is being a bit brutal.  But I think he's being honest:
> If in two and a half years you have not learned what happens when you
> "pass an array" to a function, you have scant aptitude for this
> particular discipline.  Other and worthier disciplines exist; go and
> pursue one of those.

well, you may be right to some extent. but you have also to concede that 
trying to learn a hard programming language (which i really want to, 
believe me) takes time and dedication, and in my case i must regret that 
i cannot be so dedicated, due to job and family chores.

but still, i will not surrender, i will stubbornly pursue my way to 
learning C, at my pace. if in the meantime i occasionally post some 
silly questions here at c.l.c., i think i may be excused to do so. i 
even bought the king book last week (inspired by another poster) and i 
will try to study it a bit at a time.

in the end, the most important thing is that now i have learnt something 
that i did not know before, thanks to all of the repliers, even the 
rudest. i knew(-ish) that "arrays are somewhat pointers what passed as 
arguments":

http://c-faq.com/aryptr/aryptrequiv.htm

and i *knew* that the size thing had something to do with that, but the 
DISCUSSION happens to have given me some key clarification about it. in 
italy (my country) the equivalent of "newsgroup" is sort of "discussion 
group", see?

you know, we humans are much happier when discussing, maybe even 
informally, about a given topic, instead of merely sifting thru some 
heavily annotated and terse reference tome.

thanks to all.

bye

[toc] | [prev] | [next] | [standalone]


#15184

FromNick Keighley <nick_keighley_nospam@hotmail.com>
Date2011-12-29 08:18 -0800
Message-ID<f0013251-8895-4466-bc55-6ddff897e7e9@q17g2000yqh.googlegroups.com>
In reply to#15082
On Dec 28, 10:42 am, superpollo <superpo...@tznvy.pbz> wrote:
> Eric Sosman ha scritto:
> > On 12/27/2011 3:31 PM, superpollo wrote:
> >> Kaz Kylheku ha scritto:
> >>> On 2011-12-27, superpollo <superpo...@tznvy.pbz> wrote:

<snip>

> >>> What gives is that you're not yet competent enough in C to be working on
> >>> Rosetta Code examples. Please find a different hobby.

<snip>

> >     Especially "newcomers" who've participated in this forum since
> > at least June 2009.  "Newcomers" who've taken thirty or more months
> > to fail to find the FAQ.
>
> >     Yes, Kaz is being a bit brutal.  But I think he's being honest:
> > If in two and a half years you have not learned what happens when you
> > "pass an array" to a function, you have scant aptitude for this
> > particular discipline.  Other and worthier disciplines exist; go and
> > pursue one of those.
>
> well, you may be right to some extent. but you have also to concede that
> trying to learn a hard programming language (which i really want to,
> believe me) takes time and dedication, and in my case i must regret that
> i cannot be so dedicated, due to job and family chores.
>
> but still, i will not surrender, i will stubbornly pursue my way to
> learning C, at my pace. if in the meantime i occasionally post some
> silly questions here at c.l.c., i think i may be excused to do so.

which is kind of what clc is for...

> i
> even bought the king book last week (inspired by another poster) and i
> will try to study it a bit at a time.
>
> in the end, the most important thing is that now i have learnt something
> that i did not know before, thanks to all of the repliers, even the
> rudest. i knew(-ish) that "arrays are somewhat pointers what passed as
> arguments":
>
> http://c-faq.com/aryptr/aryptrequiv.htm
>
> and i *knew* that the size thing had something to do with that, but the
> DISCUSSION happens to have given me some key clarification about it. in
> italy (my country) the equivalent of "newsgroup" is sort of "discussion
> group", see?

not really. Discussion groups and newsgroups are two different things
and are not limited by national boundaries. I have a vague
recollection there's an italian version of clc. Ah yes it.comp.lang.c
and there seems to be some activity.

> you know, we humans are much happier when discussing, maybe even
> informally, about a given topic, instead of merely sifting thru some
> heavily annotated and terse reference tome.

there's a time and a place for both and having a quick look through
the FAQ can save some time, besides improving your education. see
http://c-faq.com/

and I agree the discussion you prompted was interesting

[toc] | [prev] | [next] | [standalone]


#15086

Fromsuperpollo <superpollo@tznvy.pbz>
Date2011-12-28 11:54 +0100
Message-ID<4efaf561$0$1389$4fafbaef@reader2.news.tin.it>
In reply to#15067
Eric Sosman ha scritto:
> On 12/27/2011 3:31 PM, superpollo wrote:
>> Kaz Kylheku ha scritto:
>>> On 2011-12-27, superpollo <superpollo@tznvy.pbz> wrote:
>>>> what gives?
>>>
>>> What gives is that you're not yet competent enough in C to be working on
>>> Rosetta Code examples. Please find a different hobby.
>>
>> thanks for your constructive criticism. a beautiful way to lure
>> newcomers to the language!
> 
>     Especially "newcomers" who've participated in this forum since
> at least June 2009.

ps: i did NOT mean I AM a newcomer with that sentence... i am very well 
aware of the rough edges of this group which i lurk in since way back, 
and i am well prepared to get bruised from time to time. but NEWCOMERS 
might be scared by that, and THAT is not a good thing, IMHO.

best regards

[toc] | [prev] | [next] | [standalone]


#15150

FromPhil Carmody <thefatphil_demunged@yahoo.co.uk>
Date2011-12-29 04:12 +0200
Message-ID<874nwkyvkt.fsf@bazspaz.fatphil.org>
In reply to#15086
superpollo <superpollo@tznvy.pbz> writes:
> Eric Sosman ha scritto:
> > On 12/27/2011 3:31 PM, superpollo wrote:
> >> Kaz Kylheku ha scritto:
> >>> On 2011-12-27, superpollo <superpollo@tznvy.pbz> wrote:
> >>>> what gives?
> >>>
> >>> What gives is that you're not yet competent enough in C to be working on
> >>> Rosetta Code examples. Please find a different hobby.
> >>
> >> thanks for your constructive criticism. a beautiful way to lure
> >> newcomers to the language!
> >     Especially "newcomers" who've participated in this forum since
> > at least June 2009.
> 
> ps: i did NOT mean I AM a newcomer with that sentence... i am very
> well aware of the rough edges of this group which i lurk in since way
> back, and i am well prepared to get bruised from time to time. but
> NEWCOMERS might be scared by that, and THAT is not a good thing, IMHO.

Newcomers didn't make the statements you made, you did.
Stop trying to construct a straw man.

My reply would have been different from Kaz's. Mine would have been more
like:
"""
> i am quite unhappy with having to say to the rms
> function how big the array is...

Your state of unhappiness is because you are fighting against ancient
and immutable features of the language. Either find a language you
are happier with, or learn and remember these features of C.  
"""
Which has a vastly inferior information density.

Phil
-- 
Unix is simple. It just takes a genius to understand its simplicity
-- Dennis Ritchie (1941-2011), Unix Co-Creator

[toc] | [prev] | [next] | [standalone]


#15177

Fromsuperpollo <superpollo@tznvy.pbz>
Date2011-12-29 14:38 +0100
Message-ID<4efc6d50$0$1379$4fafbaef@reader2.news.tin.it>
In reply to#15150
Phil Carmody ha scritto:
> superpollo <superpollo@tznvy.pbz> writes:
>> Eric Sosman ha scritto:
>>> On 12/27/2011 3:31 PM, superpollo wrote:
>>>> Kaz Kylheku ha scritto:
>>>>> On 2011-12-27, superpollo <superpollo@tznvy.pbz> wrote:
>>>>>> what gives?
>>>>> What gives is that you're not yet competent enough in C to be working on
>>>>> Rosetta Code examples. Please find a different hobby.
>>>> thanks for your constructive criticism. a beautiful way to lure
>>>> newcomers to the language!
>>>     Especially "newcomers" who've participated in this forum since
>>> at least June 2009.
>> ps: i did NOT mean I AM a newcomer with that sentence... i am very
>> well aware of the rough edges of this group which i lurk in since way
>> back, and i am well prepared to get bruised from time to time. but
>> NEWCOMERS might be scared by that, and THAT is not a good thing, IMHO.
> 
> Newcomers didn't make the statements you made, you did.

such as? i made many...

> Stop trying to construct a straw man.

not trying. in all fairness, i posted a topical question and i stated my 
proposition about the function rms() that IMHO should have had to know 
the info by herself, then *someone else* tried to create the illusion of 
having refuted my proposition by replacing it with an unrelated 
proposition (the "straw man") about my supposed study negligence, and 
refuting it, without ever having actually refuted the original proposition.

> My reply would have been different from Kaz's. Mine would have been more
> like:
> """
>> i am quite unhappy with having to say to the rms
>> function how big the array is...
> 
> Your state of unhappiness is because you are fighting against ancient
> and immutable features of the language. Either find a language you
> are happier with, or learn and remember these features of C.  
> """

i choose the second option, and i will try to live by it.

regards

[toc] | [prev] | [next] | [standalone]


#15088

FromNick Keighley <nick_keighley_nospam@hotmail.com>
Date2011-12-28 02:26 -0800
Message-ID<7dcb0e0f-12d7-47ac-9971-efca881a9f47@a17g2000yqj.googlegroups.com>
In reply to#15067
On Dec 28, 1:49 am, Eric Sosman <esos...@ieee-dot-org.invalid> wrote:
> On 12/27/2011 3:31 PM, superpollo wrote:
>
> > Kaz Kylheku ha scritto:
> >> On 2011-12-27, superpollo <superpo...@tznvy.pbz> wrote:
> >>> what gives?
>
> >> What gives is that you're not yet competent enough in C to be working on
> >> Rosetta Code examples. Please find a different hobby.
>
> > thanks for your constructive criticism. a beautiful way to lure
> > newcomers to the language!
>
>      Especially "newcomers" who've participated in this forum since
> at least June 2009.  "Newcomers" who've taken thirty or more months
> to fail to find the FAQ.
>
>      Yes, Kaz is being a bit brutal.  But I think he's being honest:
> If in two and a half years you have not learned what happens when you
> "pass an array" to a function, you have scant aptitude for this
> particular discipline.  Other and worthier disciplines exist; go and
> pursue one of those.

good grief. So he missed something (something important, admittedly!).
I'm a fan of virtually anyone learning to program. I think it should
be part of 21st century literacy.

[toc] | [prev] | [next] | [standalone]


#15154

FromEric Sosman <esosman@ieee-dot-org.invalid>
Date2011-12-28 21:35 -0500
Message-ID<jdgjkr$u1g$1@dont-email.me>
In reply to#15088
On 12/28/2011 5:26 AM, Nick Keighley wrote:
> On Dec 28, 1:49 am, Eric Sosman<esos...@ieee-dot-org.invalid>  wrote:
>> On 12/27/2011 3:31 PM, superpollo wrote:
>>
>>> Kaz Kylheku ha scritto:
>>>> On 2011-12-27, superpollo<superpo...@tznvy.pbz>  wrote:
>>>>> what gives?
>>
>>>> What gives is that you're not yet competent enough in C to be working on
>>>> Rosetta Code examples. Please find a different hobby.
>>
>>> thanks for your constructive criticism. a beautiful way to lure
>>> newcomers to the language!
>>
>>       Especially "newcomers" who've participated in this forum since
>> at least June 2009.  "Newcomers" who've taken thirty or more months
>> to fail to find the FAQ.
>>
>>       Yes, Kaz is being a bit brutal.  But I think he's being honest:
>> If in two and a half years you have not learned what happens when you
>> "pass an array" to a function, you have scant aptitude for this
>> particular discipline.  Other and worthier disciplines exist; go and
>> pursue one of those.
>
> good grief. So he missed something (something important, admittedly!).
> I'm a fan of virtually anyone learning to program. I think it should
> be part of 21st century literacy.

     He "missed" something rather fundamental, rather basic, rather
second-week-of-the-first-semester.  It's on Page 24 of K&R (classic).
It's on Page 33 of "C Traps and Pitfalls."  Harbison & Steele don't
mention it until Page 248, but they don't even start talking about
functions at all until Page 237 (I don't like their book much).  The
FAQ devotes all of Section 6 to explaining pointers vis-a-vis arrays,
and in fact Question 6.21 is *exactly* the O.P.'s point of confusion.

     And in thirty months he's found none of these.

     It's been suggested that the O.P. may be overburdened by other
responsibilities, diverting him so drastically from the study of C
that he makes only (say) three weeks' progress in thirty months. His
profile in Google Groups indicates, though, that he has a fair amount
of time on his hands: He's made four thousand two hundred seventy-two
Usenet posts this year, eleven point eight per day, one every two
hours, day in and day out. He may be wasting his time, but he's got
the time.

-- 
Eric Sosman
esosman@ieee-dot-org.invalid

[toc] | [prev] | [next] | [standalone]


#15176

Fromsuperpollo <superpollo@tznvy.pbz>
Date2011-12-29 14:10 +0100
Message-ID<4efc66c7$0$1381$4fafbaef@reader2.news.tin.it>
In reply to#15154
Eric Sosman ha scritto:
> On 12/28/2011 5:26 AM, Nick Keighley wrote:
>> On Dec 28, 1:49 am, Eric Sosman<esos...@ieee-dot-org.invalid>  wrote:
>>> On 12/27/2011 3:31 PM, superpollo wrote:
>>>
>>>> Kaz Kylheku ha scritto:
>>>>> On 2011-12-27, superpollo<superpo...@tznvy.pbz>  wrote:
>>>>>> what gives?
>>>
>>>>> What gives is that you're not yet competent enough in C to be 
>>>>> working on
>>>>> Rosetta Code examples. Please find a different hobby.
>>>
>>>> thanks for your constructive criticism. a beautiful way to lure
>>>> newcomers to the language!
>>>
>>>       Especially "newcomers" who've participated in this forum since
>>> at least June 2009.  "Newcomers" who've taken thirty or more months
>>> to fail to find the FAQ.
>>>
>>>       Yes, Kaz is being a bit brutal.  But I think he's being honest:
>>> If in two and a half years you have not learned what happens when you
>>> "pass an array" to a function, you have scant aptitude for this
>>> particular discipline.  Other and worthier disciplines exist; go and
>>> pursue one of those.
>>
>> good grief. So he missed something (something important, admittedly!).
>> I'm a fan of virtually anyone learning to program. I think it should
>> be part of 21st century literacy.
> 
>     He "missed" something rather fundamental, rather basic, rather
> second-week-of-the-first-semester.  It's on Page 24 of K&R (classic).
> It's on Page 33 of "C Traps and Pitfalls."  Harbison & Steele don't
> mention it until Page 248, but they don't even start talking about
> functions at all until Page 237 (I don't like their book much).  The
> FAQ devotes all of Section 6 to explaining pointers vis-a-vis arrays,
> and in fact Question 6.21 is *exactly* the O.P.'s point of confusion.

as i said elsewhere, this thread is *exactly* my occasion to focus on 
that issue. is that fair enough?

>     It's been suggested that the O.P. may be overburdened by other
> responsibilities, diverting him so drastically from the study of C
> that he makes only (say) three weeks' progress in thirty months. His
> profile in Google Groups indicates, though, that he has a fair amount
> of time on his hands: He's made four thousand two hundred seventy-two
> Usenet posts this year, eleven point eight per day, one every two
> hours, day in and day out. He may be wasting his time, but he's got
> the time.

so you presume that posting on usenet (except clc) is a waste of time? 
wrong assumption: it is somehow part of my daily job to exchange 
messages with students on email AND on usenet (on math and science 
newsgroups, in italian language), and THAT is very time consuming (and 
demanding).

best regards

-- 
Ora l'introduzione della i, e' un atto rivoluzionario, forse
piu' rivoluzionario della introduzione dello *0*

[toc] | [prev] | [next] | [standalone]


#15107

FromJames Kuyper <jameskuyper@verizon.net>
Date2011-12-28 08:03 -0500
Message-ID<jdf43c$aph$1@dont-email.me>
In reply to#15067
On 12/27/2011 08:49 PM, Eric Sosman wrote:
> On 12/27/2011 3:31 PM, superpollo wrote:
>> Kaz Kylheku ha scritto:
>>> On 2011-12-27, superpollo <superpollo@tznvy.pbz> wrote:
>>>> what gives?
>>>
>>> What gives is that you're not yet competent enough in C to be working on
>>> Rosetta Code examples. Please find a different hobby.
>>
>> thanks for your constructive criticism. a beautiful way to lure
>> newcomers to the language!
> 
>      Especially "newcomers" who've participated in this forum since
> at least June 2009.  "Newcomers" who've taken thirty or more months
> to fail to find the FAQ.
> 
>      Yes, Kaz is being a bit brutal.  But I think he's being honest:
> If in two and a half years you have not learned what happens when you
> "pass an array" to a function, you have scant aptitude for this
> particular discipline.  Other and worthier disciplines exist; go and
> pursue one of those.

I think you're both being a bit harsh on him. When I saw his comment
about being a newcomer, I had the same response - I remembered him being
a long-term participant. However, when I searched with Google groups, I
also found out he'd been posting here for only 30 months, and I decided
not to comment. It's a fairly long time to have made so little progress
in understanding C. However, if he's learning it on his own time while
working full time, and not taking any classes in C, it's not completely
unreasonable that he might still be at this low level, particularly if
there's any other reason (such as, for example, being a single father)
that most of the rest of his "spare" time is already accounted for.
-- 
James Kuyper

[toc] | [prev] | [next] | [standalone]


#15112

From"BartC" <bc@freeuk.com>
Date2011-12-28 13:32 +0000
Message-ID<jdf5sd$kd8$1@dont-email.me>
In reply to#15107
"James Kuyper" <jameskuyper@verizon.net> wrote in message
news:jdf43c$aph$1@dont-email.me...
> On 12/27/2011 08:49 PM, Eric Sosman wrote:

>> If in two and a half years you have not learned what happens when you
>> "pass an array" to a function, you have scant aptitude for this
>> particular discipline.  Other and worthier disciplines exist; go and
>> pursue one of those.
>
> I think you're both being a bit harsh on him. When I saw his comment
> about being a newcomer, I had the same response - I remembered him being
> a long-term participant. However, when I searched with Google groups, I
> also found out he'd been posting here for only 30 months, and I decided
> not to comment.

I've been posting here a lot longer, but still have problems with some
things that should be straightforward to a C programmer.

For example, I had trouble the other night with creating a struct with
self-referential members. I tried loads of combinations including forward 
declarations and got nowhere. I was about to post here, then came across 
this form in some code that was lying around:

typedef struct snode{
 int value;
 int opcode;
 struct snode *aref,*bref;
} node;

That worked, but how can I turn the 'struct snode*' into a much tidier 'node
*'? This doesn't work:

typedef struct {
 int value;
 int opcode;
 node *aref,*bref;
} node;

-- 
Bartc 

[toc] | [prev] | [next] | [standalone]


#15114

FromDr Nick <3-nospam@temporary-address.org.uk>
Date2011-12-28 13:41 +0000
Message-ID<87hb0kg6ei.fsf@temporary-address.org.uk>
In reply to#15112
"BartC" <bc@freeuk.com> writes:

> "James Kuyper" <jameskuyper@verizon.net> wrote in message
> news:jdf43c$aph$1@dont-email.me...
>> On 12/27/2011 08:49 PM, Eric Sosman wrote:
>
>>> If in two and a half years you have not learned what happens when you
>>> "pass an array" to a function, you have scant aptitude for this
>>> particular discipline.  Other and worthier disciplines exist; go and
>>> pursue one of those.
>>
>> I think you're both being a bit harsh on him. When I saw his comment
>> about being a newcomer, I had the same response - I remembered him being
>> a long-term participant. However, when I searched with Google groups, I
>> also found out he'd been posting here for only 30 months, and I decided
>> not to comment.
>
> I've been posting here a lot longer, but still have problems with some
> things that should be straightforward to a C programmer.
>
> For example, I had trouble the other night with creating a struct with
> self-referential members. I tried loads of combinations including
> forward declarations and got nowhere. I was about to post here, then
> came across this form in some code that was lying around:
>
> typedef struct snode{
> int value;
> int opcode;
> struct snode *aref,*bref;
> } node;
>
> That worked, but how can I turn the 'struct snode*' into a much tidier 'node
> *'? This doesn't work:
>
> typedef struct {
> int value;
> int opcode;
> node *aref,*bref;
> } node;

IIRC:

typedef struct snode snode;
struct snode {
  int value;
  int opcode;
  snode *aref,*bref;
};

those empty struct things (I'm keeping well clear of the
definitions/declarations arguments here) aren't needed very often, but
when they are, they are very useful.
-- 
Online waterways route planner            | http://canalplan.eu
Plan trips, see photos, check facilities  | http://canalplan.org.uk

[toc] | [prev] | [next] | [standalone]


#15130

FromKaz Kylheku <kaz@kylheku.com>
Date2011-12-28 19:29 +0000
Message-ID<20111228111138.529@kylheku.com>
In reply to#15112
On 2011-12-28, BartC <bc@freeuk.com> wrote:
> I've been posting here a lot longer, but still have problems with some
> things that should be straightforward to a C programmer.
>
> For example, I had trouble the other night with creating a struct with
> self-referential members. I tried loads of combinations including forward 
> declarations and got nowhere. I was about to post here, then came across 
> this form in some code that was lying around:
>
> typedef struct snode{
>  int value;
>  int opcode;
>  struct snode *aref,*bref;
> } node;

There is no need for the tag and typedef name to be different. They
are in a different namespace disambiguated by the "struct" keyword:

  typedef struct node {
    int value;
    int opcode;
    struct node *aref, *bref;
  } node;

Maybe the use of two symbols snode and node adds to your perception
that it is untidy. I mean, if you have N structures, you use 2*N
identifiers in their naming.

> That worked, but how can I turn the 'struct snode*' into a much tidier 'node
> *'? This doesn't work:

This brings to mind an earlier Eric Sosman posting, where he recounted
an analogy from a friend: maybe you're trying to clean the beach of bottle caps
and cigarette butts so that the areas around the rotting whale carcasses are
nice and clean.

How tidy will the overall program be when it grows large and complex?

Big C programs are very hard to keep tidy. Even if the program is developed by
a  single developer in his spare time, who is single-mindedly dedicated to
tidiness, tidiness will eventually give way here and there to functionality.

> typedef struct {
>  int value;
>  int opcode;
>  node *aref,*bref;
> } node;


Perfectly valid C++, hint hint:

  struct node {
    node *aref;
  };

In C there is no way around the keyword struct occuring twice, e.g:

  /* A */
  typedef struct node node;
  struct node {
    node *aref, *bref;
  };


  /* B */
  struct node {
    typedef struct node node;
    node *aref, *bref;
  };

B loses C++ compatibility though. The typedef name is not scoped to
the struct in C, but in C++ it is in class scope. 

Well, there is always preprocessing:

  #define node struct node

  node {   /* oh, boy! */
    node *a, *b;
  }

[toc] | [prev] | [next] | [standalone]


#15136

FromKeith Thompson <kst-u@mib.org>
Date2011-12-28 13:47 -0800
Message-ID<lnipl0z7uq.fsf@nuthaus.mib.org>
In reply to#15112
"BartC" <bc@freeuk.com> writes:
[...]
> For example, I had trouble the other night with creating a struct with
> self-referential members. I tried loads of combinations including forward 
> declarations and got nowhere. I was about to post here, then came across 
> this form in some code that was lying around:
>
> typedef struct snode{
>  int value;
>  int opcode;
>  struct snode *aref,*bref;
> } node;
>
> That worked, but how can I turn the 'struct snode*' into a much tidier 'node
> *'? This doesn't work:
>
> typedef struct {
>  int value;
>  int opcode;
>  node *aref,*bref;
> } node;

My suggestion is just to drop the "typedef" altogether, and refer to the
type as "struct snode":

    struct snode {
        int value;
        int opcode;
        struct snode *aref;
        struct snode *bref;
    };

If you feel the need to have a one-word name for the type, you can
typedef the incomplete struct type and then complete it by defining it.
Note that there's no need to use different names for the struct tag and
the typedef:

    typedef struct snode snode;
    struct snode {
        int opcode;
        snode *aref;
        snode *bref;
    };

Another common approach is to combine the typedef and struct
declarations -- but then the typedef isn't visible until the end
of the struct declaration:

    typedef struct snode {
        int opcode;
        struct snode *aref;
        struct snode *bref;
    } snode;

But really, the type already has a perfectly good name, "struct snode".
Hiding its "structness" behind a typedef doesn't buy you anything.

-- 
Keith Thompson (The_Other_Keith) kst-u@mib.org  <http://www.ghoti.net/~kst>
    Will write code for food.
"We must do something.  This is something.  Therefore, we must do this."
    -- Antony Jay and Jonathan Lynn, "Yes Minister"

[toc] | [prev] | [next] | [standalone]


Page 2 of 3 — ← Prev page 1 [2] 3  Next page →

Back to top | Article view | comp.lang.c


csiph-web