Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > kandr2 question

Reply
Thread Tools

kandr2 question

 
 
Nick Keighley
Guest
Posts: n/a
 
      11-10-2012
On Oct 30, 10:04*pm, "Bill Cunningham" <(E-Mail Removed)> wrote:
> tom st denis wrote:
> > If you don't know that char s[] is equivalent to char *s by now you
> > have to be trolling and are deserving of contempt.

>
> * * Of course I know that Dick. What's that got to do with anything? Read
> the standard.


what?

> > And frankly I don't get you. *Trolling comp.lang.c? *Do you know how
> > specific that is? *Of the few 100,000 people on the planet who are
> > aware of C you have to be one of the trolls? *Seriously? *Get a hobby.

>
> * * You're the one dropping a troll.


 
Reply With Quote
 
 
 
 
Nick Keighley
Guest
Posts: n/a
 
      11-10-2012
On Oct 30, 10:09*pm, "Bill Cunningham" <(E-Mail Removed)> wrote:
> tom st denis wrote:


CONTEXT!!!!!!!!!!!!!!!

> > And since clearly you seem to know this [judging by your reply here]
> > why the <expletive> are you asking?

>
> None of your <expletive> Business and *I* was right. But that's not my point.


if a question makes no sense then knowing the reason for asking it may
help work what the question is really about. You were not right you
were 100% wrong.

 
Reply With Quote
 
 
 
 
Nick Keighley
Guest
Posts: n/a
 
      11-10-2012
On Oct 30, 10:30*pm, "Bill Cunningham" <(E-Mail Removed)> wrote:
> tom st denis wrote:
> > It's convention to use the star but that's not mandatory. *Just like
> > you could write

>
> > char a[4];

>
> > a[3] = 4;

>
> > Or

>
> > 3[a] = 4;

>
> > They're equivalent C code. *Most people would use the former instead
> > of the latter even though they have the same effect.

>
> > Tom

>
> In my original question I was asking about convention.


and the answer is it's a convention that isn't adhered to very widely.
Maybe most code uses it but nowhere near all. As I remarked earlier I
use array syntax myself if I expect most callers to be passing an
array. I sometimes think it makes the intent of the code clearer.
 
Reply With Quote
 
Nick Keighley
Guest
Posts: n/a
 
      11-10-2012
On Oct 30, 11:28*pm, "Bill Cunningham" <(E-Mail Removed)> wrote:
> tom st denis wrote:
> > On Oct 30, 6:30 pm, "Bill Cunningham" <(E-Mail Removed)> wrote:
> >> tom st denis wrote:
> >>> It's convention to use the star but that's not mandatory. Just like
> >>> you could write

>
> >>> char a[4];

>
> >>> a[3] = 4;

>
> >>> Or

>
> >>> 3[a] = 4;

>
> >>> They're equivalent C code. Most people would use the former instead
> >>> of the latter even though they have the same effect.

>
> >>> Tom

>
> >> In my original question I was asking about convention.

>
> > No you didn't. *Here's your original question

>
> >> Unless I'm missing something here to pass an array shoudn't that
> >> first parameter be char *s ?

>
> > And the answer is no. *It's not an error, it can be "char s[]" if the
> > author wants to write that way.

>
> > Tom

>
> Let me write what was intended in my mind,
>
> >> Unless I'm missing something here to pass an array shoudn't that
> >> first parameter be char *s [by convention]?

>
> And the answer is no. It should be char *s [by convention] of course.


no.
 
Reply With Quote
 
Nick Keighley
Guest
Posts: n/a
 
      11-10-2012
On Oct 30, 11:50*pm, "Bill Cunningham" <(E-Mail Removed)> wrote:
> Lew Pitcher wrote:
> > Sidenote: /This/ (E-Mail Removed) doesn't sound like the usual
> > Bill that we all know. Either something has changed drastically with
> > Bill, or the group has been trolled by someone posing as Bill.

>
> * * What do you mean? I'm starting to get tired of being misrepresented and
> accused of things wrongly. I have problems focusing and other mental issues.
> I'm not whining but there's a reason I catch on slow. And a lack of things
> to do with C except the UNIX API. I'm thinking of an example cbc_crypt in
> the API for n*xs that takes arrays and the prototypes are declared as
> pointers to char.


except you seem to make no attempt to compensate for your alleged
problems. I for instance combat a poor memory by taking notes and
*using* them.

 
Reply With Quote
 
Nick Keighley
Guest
Posts: n/a
 
      11-10-2012
On Oct 30, 10:11*pm, tom st denis <(E-Mail Removed)> wrote:
> On Oct 30, 6:08*pm, "BartC" <(E-Mail Removed)> wrote:
>
> > "tom st denis" <(E-Mail Removed)> wrote in messagenews:(E-Mail Removed)...

>
> > > On Oct 30, 5:50 pm, "Bill Cunningham" <(E-Mail Removed)> wrote:
> > >> * That's what I have been told.

>
> > > If you don't know that char s[] is equivalent to char *s by now you
> > > have to be trolling and are deserving of contempt.

>
> > But in certain contexts, they are not the same. The question is reasonable.

>
> As a function parameter? *They're entirely interchangeable. *It's
> convention to use the star


no it isna't

> but you can use [] if it floats your boat.
>
> Tom


 
Reply With Quote
 
Nick Keighley
Guest
Posts: n/a
 
      11-10-2012
On Oct 31, 12:51*am, Keith Thompson <(E-Mail Removed)> wrote:
> "Bill Cunningham" <(E-Mail Removed)> writes:
>
> [...]
>
> > * * I just didn't appreciate being attacked and accused of not knowing
> > things I know obviously. I am not a newbie no but it was *meant* as a style
> > question as you say.

>
> Not to defend the attacks you've been subjected to in this thread,
> but when I read your original question I did assume that you weren't
> aware that "char foo[]" and "char *foo" are equivalent as parameter
> definitions. *It seemed to me to be a reasonable assumption based
> on your history. In any case, the exact same question could have
> been asked by someone who *didn't* know about the equivalence.
>
> Wording your question more clearly might have avoided a lot of
> misunderstanding.


the sun will be a cold cinder before Bill manages to ask a clear, well
thought out question
 
Reply With Quote
 
Nick Keighley
Guest
Posts: n/a
 
      11-10-2012
On Oct 31, 5:47*pm, "Bill Cunningham" <(E-Mail Removed)> wrote:
> Keith Thompson wrote:
> > Not to defend the attacks you've been subjected to in this thread,
> > but when I read your original question I did assume that you weren't
> > aware that "char foo[]" and "char *foo" are equivalent as parameter
> > definitions. *It seemed to me to be a reasonable assumption based
> > on your history. In any case, the exact same question could have
> > been asked by someone who *didn't* know about the equivalence.

>
> > Wording your question more clearly might have avoided a lot of
> > misunderstanding.

>
> * * I thought in other posts and as long as I've been around that it would
> be a reasonable assumption that in the very least I would know the sameness
> and differences about pointers and arrays. Agreed my wording could've been
> better but alot of that has always been my problem. I didn't know about the
> word "convention" but I know I had been told that in the case of a parameter
> declartion for taking an array was a pointer to whatever. I also assume that
> kandr2 isn't wrong. So I wanted to clear up the confusion. I believe now
> that it is legal C but not conventional.


a point I don't agree with
 
Reply With Quote
 
Nick Keighley
Guest
Posts: n/a
 
      11-10-2012
On Nov 1, 7:13*pm, Barry Schwarz <(E-Mail Removed)> wrote:
> On Thu, 1 Nov 2012 09:34:34 +0000 (UTC), Ike Naar
>
>
>
>
>
>
>
>
>
> <(E-Mail Removed)> wrote:
> >On 2012-11-01, Barry Schwarz <(E-Mail Removed)> wrote:
> >> On Wednesday, October 31, 2012 10:52:40 AM UTC-7, Bill Cunningham wrote:
> >>> Barry Schwarz wrote:
> >>>> Granted that the parameter COULD be changed as you describe, why do
> >>>> you think it SHOULD be changed?
> >>>[snip]
> >>>n1570.

>
> >> There is no n1570.

>
> >There ishttp://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf,
> >a draft version of the C 2011 Standard.

>
> >> All the numbers under the N are in the range of 31 to 45.

>
> >No idea what that is supposed to mean. Can you clarify?

>
> You have never played Bingo??


I wasn't aware there was a convention for the numbers in bingo
 
Reply With Quote
 
hormelfree@gmail.com
Guest
Posts: n/a
 
      11-10-2012
On Saturday, November 10, 2012 6:52:59 AM UTC-8, Nick Keighley wrote:
> the sun will be a cold cinder before Bill manages to ask a clear, well
> thought out question


So Bill is the cure for global warming? ALL HAIL BILL!!!

---
William Ernest Reid
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
question row filter (more of sql query question) =?Utf-8?B?YW5kcmV3MDA3?= ASP .Net 2 10-06-2005 01:07 PM
Quick Question - Newby Question =?Utf-8?B?UnlhbiBTbWl0aA==?= ASP .Net 4 02-16-2005 11:59 AM
Question on Transcender Question :-) eddiec MCSE 6 05-20-2004 06:59 AM
Question re: features of the 831 router (also a 924 question) Wayne Cisco 0 03-02-2004 07:57 PM
Syntax Question - Novice Question sean ASP .Net 1 10-20-2003 12:18 PM



Advertisments