what's the difference between the next 2 declarations?

E

E. Robert Tisdale

Richard said:
E. Robert Tisdale said:
Dan said:
How about reading the FAQ *before* posting?

Why would Wade read the [C] FAQ *before* posting?

Because it is nothing but polite to read the FAQ
for _any_ newsgroup you intend to start posting to.
So is reading a reasonable amount of backlog.
It's basic netiquette, really.
Which explains why it's done so rarely :-(

The C++ FAQ is enormous.
We can't even get regular subscribers to read it.
It isn't reasonable to expect new subscriber to read it
before posting to the comp.lang.c++ newsgroup.
New subscribers are usually just learning C++.
They usually don't have the knowledge required
to understand everything in the C++ FAQ.
Most of the answers are irrelevant
to the questions that new subscribers ask.
You might ask new subscribers
to *search* the C++ FAQ for the answers to their questions
before posting them to the comp.lang.c++ newsgroup
but new subscribers often don't even have the knowledge
required to formulate an efficient query
that will take them to the relevant FAQ.

I don't think that Dan Pop's rhetorical question,
"How about reading the FAQ *before* posting?", was very helpful.
I don't think that Dan Pop was trying to be helpful.
If he wanted to be helpful, he could have posted

The 1.32 FAQ answers to the Wade's question.
http://www.eskimo.com/~scs/C-faq/q1.32.html

as Regis Troadec did.
This directed Wade to a relevant answer to his question
and also told him how to find the FAQ.

I think that Dan is having trouble with self esteem.
His ridicule of other people raises his self esteem
relative to those people. Unfortunately, the effect is temporary
and he must soon find someone else to ridicule.

I don't mean to pick on Dan. There are a lot of nerds and geeks
with the same problem subscribing to this newsgroup
and some people think that this behavior defines us as a group.
 
C

CBFalconer

E. Robert Tisdale said:
Richard said:
E. Robert Tisdale said:
Dan Pop wrote:

How about reading the FAQ *before* posting?

Why would Wade read the [C] FAQ *before* posting?

Because it is nothing but polite to read the FAQ
for _any_ newsgroup you intend to start posting to.
So is reading a reasonable amount of backlog.
It's basic netiquette, really.
Which explains why it's done so rarely :-(

The C++ FAQ is enormous.
We can't even get regular subscribers to read it.
It isn't reasonable to expect new subscriber to read it
before posting to the comp.lang.c++ newsgroup.

As has been said before, Trollsdale only does it to annoy. The
C++ FAQ has absolutely nothing to do with the C language. Also
note his sly 'we'. I doubt that c.l.c++ regulars consider that an
appropriate pronoun.

I am only feeding this troll in order to avoid newbies being
intimidated from FAQ reading.
 
R

Richard Bos

E. Robert Tisdale said:
Richard said:
E. Robert Tisdale said:
Dan Pop wrote:

How about reading the FAQ *before* posting?

Why would Wade read the [C] FAQ *before* posting?

Because it is nothing but polite to read the FAQ
for _any_ newsgroup you intend to start posting to.
So is reading a reasonable amount of backlog.
It's basic netiquette, really.
Which explains why it's done so rarely :-(

The C++ FAQ is enormous.

That has nothing whatsoever to do with comp.lang.c.
I don't think that Dan Pop was trying to be helpful.
If he wanted to be helpful, he could have posted

The 1.32 FAQ answers to the Wade's question.
http://www.eskimo.com/~scs/C-faq/q1.32.html

as Regis Troadec did.

I agree that this is even better, but that doesn't mean that Dan was
wrong.
I think that Dan is having trouble with self esteem.

While I agree, I note that he is not the only regular on c.l.c whom I
would Freudianise that way *pointed looks*.

Richard
 
W

Wade Yin

The FAQ shows the declaration like:

char a[] = "string literal";

But in the OP's question it is like:

char y[] = {"string literal"};

Are they same?

well , It looks same,
I try it with the following code:

int main()
{
char a[]={"12345"};
char b[]="abcdef";
char *p;

pirntf("now a is:%s\n", a);
p=a;
*p='a';
printf("now a is:%s\n", p);

printf("now b is:%s\n", b);
p=b;
*(p+1)='1';
printf("now b is:%s\n", p);

return 0;
}

the output is like this:
now a is:12345
now a is:a2345
now b is: abcdef
now b is: 1bcdef

so , I changed the value with a point 'p'...


Wade
 
D

Dan Pop

In said:
I don't think that Dan Pop's rhetorical question,
"How about reading the FAQ *before* posting?", was very helpful.

It was extremely helpful. Regardless of what you think.
I don't think that Dan Pop was trying to be helpful.
If he wanted to be helpful, he could have posted

The 1.32 FAQ answers to the Wade's question.
http://www.eskimo.com/~scs/C-faq/q1.32.html

as Regis Troadec did.
This directed Wade to a relevant answer to his question
and also told him how to find the FAQ.

Spoonfeeding the lazy posters to this newsgroup merely passes the wrong
message to other newbies: "don't bother reading the FAQ yourself, someone
who has already done it will give you a complete reference, or even
quote the text so that you don't have to bother finding the FAQ".

Therefore, I include a reference ONLY when it is not immediately obvious
that the FAQ question actually covers the poster's issue.

As to finding the location of the FAQ, some people have already heard
about Google. Type "comp.lang.c FAQ" and click on "I'm Feeling Lucky".

Dan
 
B

Barry Schwarz

The FAQ shows the declaration like:

char a[] = "string literal";

But in the OP's question it is like:

char y[] = {"string literal"};

Are they same?

well , It looks same,
I try it with the following code:

int main()
{
char a[]={"12345"};
char b[]="abcdef";
char *p;

pirntf("now a is:%s\n", a);

Must be an extension unique to your compiler.
p=a;
*p='a';
printf("now a is:%s\n", p);

printf("now b is:%s\n", b);
p=b;
*(p+1)='1';
printf("now b is:%s\n", p);

return 0;
}

the output is like this:
now a is:12345
now a is:a2345
now b is: abcdef

There is no leading space in the initialization of b. There no space
between the : and the % in the format string. Why is there a space in
your output?
now b is: 1bcdef

Surely you meant a1cdef.
so , I changed the value with a point 'p'...
Please cut and paste your code, don't retype it. Same for output.


<<Remove the del for email>>
 
P

Peter Pichler

[Sorry about replying two links down the line, the former messages
have expired from my server.]
Richard said:
E. Robert Tisdale said:
Dan Pop wrote:

How about reading the FAQ *before* posting?

Why would Wade read the [C] FAQ *before* posting?

Because it is nothing but polite to read the FAQ for _any_
newsgroup you intend to start posting to.

Actually, ERT might have a point here, although probably *not* the one
(s)he intended: Wade should have read the FAQ *instead of* posting :)

Peter
 
D

Dave Thompson

On 7 Apr 2004 06:46:48 -0700, (e-mail address removed) (anonymous)
wrote:
char a[] = "string literal";
char y[] = {"string literal"};

Are they same?

well , It looks same,
I try it with the following code:
char a[]={"12345"};
char b[]="abcdef";
char *p;

pirntf("now a is:%s\n", a);

Must be an extension unique to your compiler.
Nope. C99 6.7.8p14 unchanged from C90 6.5.7:
An array of character type may be initialized by a character string
literal, optionally
enclosed in braces. Successive characters of the character string
literal (including the
terminating null character if there is room or if the array is of
unknown size) initialize the
elements of the array.

- David.Thompson1 at worldnet.att.net
 
B

Barry Schwarz

On 7 Apr 2004 06:46:48 -0700, (e-mail address removed) (anonymous)
wrote:
char a[] = "string literal";
char y[] = {"string literal"};

Are they same?

well , It looks same,
I try it with the following code:
char a[]={"12345"};
char b[]="abcdef";
char *p;

pirntf("now a is:%s\n", a);

Must be an extension unique to your compiler.
Nope. C99 6.7.8p14 unchanged from C90 6.5.7:
An array of character type may be initialized by a character string
literal, optionally
enclosed in braces. Successive characters of the character string
literal (including the
terminating null character if there is room or if the array is of
unknown size) initialize the
elements of the array.

My comment was on the function call, not the array initialization.
Where is the prototype for ***pirntf*** on your compiler?



<<Remove the del for email>>
 
W

Wade Yin

On 7 Apr 2004 06:46:48 -0700, (e-mail address removed) (anonymous)
char a[]={"12345"};
char b[]="abcdef";
char *p;

pirntf("now a is:%s\n", a);

Must be an extension unique to your compiler.

My comment was on the function call, not the array initialization.
Where is the prototype for ***pirntf*** on your compiler?


OK , it's my mistake, I just try the code in a Linux box, and re-input
it in another machine, so I made some mis-input, don't be angry, don't
complain, next time I will copy all the input and output message from
emacs.

But maybe we should more focus on "anonymous" 's question, right?!
What is the main problem?

This time , my fault, make some people feel bad.

And, Peter is right, I should read FAQ before I come here...

:-(
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top