I have a doubt

C

Chris McDonald

I have two doubts myself: Why do you post under the russian looking
name "ivan", when it is clear to everybody that you are from india, and
could you please please please tell us why people from India write "I
have a doubt" instead of "I have a question"?


Oh come on, grow up!
Why do you post using the name 'Christian', when you exhibit no ability to
be accepting and tolerant?
 
C

Christopher Benson-Manica

christian.bau said:
I have two doubts myself: Why do you post under the russian looking
name "ivan", when it is clear to everybody that you are from india

Does it matter? If you chose to post as "vasily", would you expect to
have to justify that choice given that you seem to be from England?
and
could you please please please tell us why people from India write "I
have a doubt" instead of "I have a question"?

(Apologies for the line length.)

http://groups.google.com/group/comp.lang.c/browse_thread/thread/7c02aab5b83e6190/5d7ff1805959f510
 
C

CBFalconer

Christopher said:
(e-mail address removed) wrote:

(WRT "A && B || C"):


Am I the only poster who abhors explicit parentheses in such simple
cases? If we are to assume that the code maintainer cannot be
trusted to know or figure out the correct order of evaluation, what
argues against such abominations as

Because the C rules are weird and wonderful, and totally confusing
to anyone used to a rational set of rules. If you need to rely on
"precedence" beyond multiplicative, additive, logical (highest to
lowest) use explicit parentheses to ensure readability. You will
avoid much future confusion, and reduce the number of threads
similar to this one.

Even algebraic precedence is apparently unknown to the
manufacturers of most 4 function calculators.
 
S

santosh

christian.bau said:
I have two doubts myself: Why do you post under the russian looking
name "ivan", when it is clear to everybody that you are from india,

The OP will have to supply the definitive answer but I can hazard a
guess. His first name's probably 'Navi' or beginning with the same. He
probably thought it was cool to reverse it and get a Russian sounding
name.
and
could you please please please tell us why people from India write "I
have a doubt" instead of "I have a question"?

Because, in English as it's taught here the word doubt is synonymous
with the word question.
 
B

Ben Bacarisse

CBFalconer said:
Because the C rules are weird and wonderful, and totally confusing
to anyone used to a rational set of rules.

They have always seemed very well thought out to me, but I understand
from other postings of yours that we will not agree on this.
If you need to rely on
"precedence" beyond multiplicative, additive, logical (highest to
lowest) use explicit parentheses to ensure readability. You will
avoid much future confusion, and reduce the number of threads
similar to this one.

You have to add more than that or you and your readers will go
bonkers. Probably at least dereference, ".", "->", cast, array
subscript, function call and assignment. I might add even more, but
then I like C's rules.

For example the perfectly reasonable:

h = h * 37UL + (unsigned char) *string++;

would be

h = (h * 37UL + ((unsigned char) *(string++)));

by your rules.
 
C

CBFalconer

santosh said:
christian.bau wrote:
.... snip ...

The OP will have to supply the definitive answer but I can hazard a
guess. His first name's probably 'Navi' or beginning with the same. He
probably thought it was cool to reverse it and get a Russian sounding
name.

Maybe Ivan is an expatriate Russian, fleeing from Putins poisoners.
Because, in English as it's taught here the word doubt is synonymous
with the word question.

The usage seems odd to us, but the meaning is clear. More to the
point, why do many Indians persist in using silly abbreviations
such as u, ur, etc. Did they pick it up from the kewl script
kiddies or other low lifes.
 
C

CBFalconer

Ben said:
They have always seemed very well thought out to me, but I understand
from other postings of yours that we will not agree on this.


You have to add more than that or you and your readers will go
bonkers. Probably at least dereference, ".", "->", cast, array
subscript, function call and assignment. I might add even more, but
then I like C's rules.

For example the perfectly reasonable:

h = h * 37UL + (unsigned char) *string++;

would be

h = (h * 37UL + ((unsigned char) *(string++)));

by your rules.

You have a point. I was making the implied assumption that we were
dealing with arithmetical operators.
 
C

Chris Torek

CBFalconer said:
Because the C [parsing] rules [for various operators] are weird
and wonderful, and totally confusing to anyone used to a rational
set of rules.

They have always seemed very well thought out to me, but I understand
from other postings of yours that we will not agree on this.

The main exception to this is the binding of "&" and "|". Dennis
Ritchie explained their mis-placement in a Usenet posting many years
ago. Once upon a time, C did not have "&&" and "||" operators.
Instead, if you wanted to check whether p was non-NULL before
accessing p->field, you wrote [%]:

if (p != NULL & p->field)

The compiler would figure out that you meant "&&" by seeing that
the "&" operator was placed in a boolean context -- i.e., the
test inside an if (or while loop or similar) -- and do a logical
AND instead of a bitwise AND. After experience with this, the
Bell Labs folks decided to put in a separate "&&" operator, so
that not only could you write:

if (p != NULL && p->field)

(with the obvious meaning), but you could also do:

result = p != NULL && p->field;

(with the logical AND meaning, rather than the bitwise AND you
would get with a single "&" -- remember that prototypic-C was
extremely cavalier about types, so the compiler would cheerfully
treat the pointer as an integer here).

When the operators were split, the syntax was not adjusted, leaving
the now-always-bitwise & and | operators in the "wrong" positions,
precedence/binding-wise. The result is that:

if (x & MASK == 0)

binds as:

if (x & (MASK == 0))

instead of the "more obvious":

if ((x & MASK) == 0)

because prototypic-C took this to mean:

if (x && MASK == 0)

which clearly *should* (and still does) bind as:

if (x && (MASK == 0))
-----
[%] Actually, "p && p->field" would be more likely, or perhaps
"p != 0 && p->field". Not only was the language quite casual about
interchanging integers and pointers, so were programmers, who
rather often wrote odd code like:

0770440->bar = addr;

In those days, no casts were required, and none used. :)
 
J

James Dow Allen

CBFalconer said:
No.

Because the C rules are weird and wonderful, and totally confusing
to anyone used to a rational set of rules.

Many of the unusual precedences are easy to remember
when you notice a pattern: "&" is spelled similarly to "&&",
so like the latter "&" has a low precedence. Similarly ">"
and "<" have low precedence and so do ">>" and "<<".
(Obviously the pattern doesn't follow a simple rule --
& is higher than && but << is higher than < -- but that
isn't a source of confusion.)

I also object to the idea that complex expressions should
be avoided. I frequently write complicated variants of
if (0
|| foo1 && foo2 && foo3
|| foo4 && foo5 && foo6
|| foo7 && foo8 && foo9)
launch();
Often this is the simplest most readable form of the logic.
(The leading "0 ||" may seem silly, but gives the expression
an easily-read, easily-edited pattern.)

James Dow Allen
 
S

santosh

CBFalconer said:
The usage seems odd to us, but the meaning is clear. More to the
point, why do many Indians persist in using silly abbreviations
such as u, ur, etc. Did they pick it up from the kewl script
kiddies or other low lifes.

It's the result of the rampant use of cell phones with SMS facility.
Since each character costs a certain amount, ridiculous abbreviations
become the norm, gradually invading into email, forums and probably
even snail mail, God forbid if I know.

Cost is also, partly, the reason why the very vast majority use Google
Groups to access Usenet. Subscriptions with news providers are not
cheap, (especially if you consider that almost no Indian ISP provides
Usenet access as a part of their package), and hunting around for
public/free news servers is too much of a technical hassle.
 
I

Ian Collins

James said:
I also object to the idea that complex expressions should
be avoided. I frequently write complicated variants of
if (0
|| foo1 && foo2 && foo3
|| foo4 && foo5 && foo6
|| foo7 && foo8 && foo9)
launch();
Often this is the simplest most readable form of the logic.
(The leading "0 ||" may seem silly, but gives the expression
an easily-read, easily-edited pattern.)
I'd prefer something like:

if( whateverTheConditionIsForLaunch() )
{
launch();
}
 
R

Richard Bos

Ian Collins said:
I'd prefer something like:

if( whateverTheConditionIsForLaunch() )
{
launch();
}

And what would you put in the horribly sTuDlYcApPeD and far too
verbosely named whateverTheConditionIsForLaunch()? Possibly something
like this:

int whateverTheConditionIsForLaunch(void)
{
return 0
|| foo1 && foo2 && foo3
|| foo4 && foo5 && foo6
|| foo7 && foo8 && foo9;
}

Not an improvement, IMO.

Richard
 
R

Richard Bos

santosh said:
Because, in English as it's taught here the word doubt is synonymous
with the word question.

Then, beg pardon, what's taught there isn't English.

Richard
 
I

Ian Collins

Richard said:
And what would you put in the horribly sTuDlYcApPeD and far too
verbosely named whateverTheConditionIsForLaunch()? Possibly something

The name would be something that explained the condition.
like this:

int whateverTheConditionIsForLaunch(void)
{
return 0
|| foo1 && foo2 && foo3
|| foo4 && foo5 && foo6
|| foo7 && foo8 && foo9;
}

Not an improvement, IMO.
Maybe not in this case, but if the condition was complex enough to
justify a comment, then it would.
 
I

Ian Collins

santosh said:
I didn't realise that English had been standardised by the ISO.
Can you point us to a dictionary that lists doubt as a synonym of question?
 
S

santosh

Ian said:
Can you point us to a dictionary that lists doubt as a synonym of question?

And can you point us to a country that enforces the English vocabulary
of it's people with a dictionary?
 

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

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,142
Latest member
arinsharma
Top