473,404 Members | 2,170 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 software developers and data experts.

Mystery: static variables & performance

I've encountered a troublesome inconsistency in the C-language Perl
extension I've written for CPAN (Digest::SHA). The problem involves the
use of a static array within a performance-critical transform function.
When compiling under gcc on my big-endian PowerPC (Mac OS X),
declaring this array as "static" DECREASES the transform throughput by
around 5%. However, declaring it as "static" on gcc/Linux/Intel
INCREASES the throughput by almost 30%.

I would prefer that the array not be "static" so that the underlying C
function will be thread-safe. However, giving up close to 30%
performance on gcc/Linux/Intel is unacceptable for a digest routine,
whose value is often closely tied to speed.

Can anyone enlighten me on this mystery, and recommend a simple, clean,
portable way to assure good performance on all host types?

TIA, Mark

Nov 14 '05
115 7449
On Mon, 09 Feb 2004 18:42:57 -0700, Mark Shelor
<ms*****@comcast.removeme.net> wrote:
Rob Thorpe wrote:
There are no portable ways to assure performance.
There are ways that work on a wide range of systems.
Asking about the performance of a set of different platforms is a
highly *platform specific* question.

With respect, Rob, you're simply not correct.

There are clever ways to use the C language that--in general--are more
efficient across a wide range of platforms. I illustrated this point
earlier with a simple string-copy example.


Yes, you presented:

<begin quote>
No, because the people who created the language--and refined its
definition into a standard--are reasonably intelligent, unlike your
example. Is

while ((*s++ = *t++) != '\0')
;

an efficient way to perform a string copy? Yes, probably more so than
<end quote>

An observation - this is probably not the most efficient way to
perform a string copy. The most efficient way is probably to use the
strcpy() library function, because the implementor knows how to
optimize the operation on the specific platform he's implementing it
for.

"Clever" programmers sometimes outsmart themselves.

<snip>

--
Al Balmer
Balmer Consulting
re************************@att.net
Nov 14 '05 #51
On Mon, 09 Feb 2004 18:42:57 -0700, in comp.lang.c , Mark Shelor
<ms*****@comcast.removeme.net> wrote:
Rob Thorpe wrote:
There are no portable ways to assure performance.
There are ways that work on a wide range of systems.
Asking about the performance of a set of different platforms is a
highly *platform specific* question.

With respect, Rob, you're simply not correct.

There are clever ways to use the C language that--in general--are more
efficient across a wide range of platforms. I illustrated this point
earlier with a simple string-copy example.


Did you? And what range of systems did you verify that it was more
efficient on, and where in the C standard does it say that this shall be
so?

--
Mark McIntyre
CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
CLC readme: <http://www.angelfire.com/ms3/bchambless0/welcome_to_clc.html>
----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
Nov 14 '05 #52
Alan Balmer wrote:
Yes, you presented:

<begin quote>
No, because the people who created the language--and refined its
definition into a standard--are reasonably intelligent, unlike your
example. Is

while ((*s++ = *t++) != '\0')
;

an efficient way to perform a string copy? Yes, probably more so than
<end quote>

An observation - this is probably not the most efficient way to
perform a string copy. The most efficient way is probably to use the
strcpy() library function, because the implementor knows how to
optimize the operation on the specific platform he's implementing it
for.

"Clever" programmers sometimes outsmart themselves.

Thanks for your attention, Alan, but you've still missed the point. The
purpose of the example was not to find the most efficient way to perform
string copies. Rather, it was to show that certain C language
constructs (such as combined pointer-dereferencing/post-incrementing)
are more efficient than others in carrying out prescribed tasks. This
demonstrates that language semantics and language definition are not
always de-coupled from issues of performance.

Regards, Mark

Nov 14 '05 #53
On Tue, 10 Feb 2004 15:43:55 -0700, in comp.lang.c , Mark Shelor
<ms*****@comcast.removeme.net> wrote:
while ((*s++ = *t++) != '\0')
;
it was to show that certain C language
constructs (such as combined pointer-dereferencing/post-incrementing)
are more efficient than others in carrying out prescribed tasks.
In order to show that, you;d have to come up with a different way to do the
above, and then prove it was less efficient on all platforms. And you'll
have to provide a definition of efficient (less code, easier to type,
readable, faster, less likely to pagefault, fewer registers used? etc)
This
demonstrates that language semantics and language definition are not
always de-coupled from issues of performance.


When you've proved that it is more efficient, then I'll agree.
--
Mark McIntyre
CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
CLC readme: <http://www.angelfire.com/ms3/bchambless0/welcome_to_clc.html>
----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
Nov 14 '05 #54
Mark McIntyre wrote:
On Tue, 10 Feb 2004 15:43:55 -0700, in comp.lang.c , Mark Shelor
<ms*****@comcast.removeme.net> wrote:
while ((*s++ = *t++) != '\0')
;

it was to show that certain C language
constructs (such as combined pointer-dereferencing/post-incrementing)
are more efficient than others in carrying out prescribed tasks.


In order to show that, you;d have to come up with a different way to do the
above, and then prove it was less efficient on all platforms. And you'll
have to provide a definition of efficient (less code, easier to type,
readable, faster, less likely to pagefault, fewer registers used? etc)
This
demonstrates that language semantics and language definition are not
always de-coupled from issues of performance.


When you've proved that it is more efficient, then I'll agree.

With respect, Mark, your agreement or disagreement on this point is not
relevant to the topic.

If, on the other hand, you feel that the topic itself is not relevant to
this newsgroup, then ceasing to contribute to this thread will spare you
further frustration.

Regards, Mark

Nov 14 '05 #55
pete wrote:
[snip]

http://www.bluejo.demon.co.uk/poetry...ia/lurkers.htm


Thank you, Pete (and to Jo Walton) -- that made my night!

-Rich

Nov 14 '05 #56
Rich Dawes wrote:
pete wrote:

http://www.bluejo.demon.co.uk/poetry...ia/lurkers.htm


Thank you, Pete (and to Jo Walton) -- that made my night!

Absolutely side-splitting. Let's hope that Triumph The Insult Comic Dog
doesn't read it and suffer a nervous breakdown.

It's now abundantly clear, given the length and content of this thread,
that the comp.lang.c guardians of purity are themselves not averse to
off-topic posting. They simply don't want others to enjoy the same
privileges. It even appears that some of these guardians have entered a
realm where jejune poems about newsgroup lurkers are somehow more
relevant to the C programming language than static variables and
performance.

Once again, there are certainly intelligent and helpful posts that occur
here. So, it's not quite fair to say that this newsgroup has the same
relation to the C language that a Star Trek convention does to rocket
science. But it IS demonstrably less helpful than newsgroups for other
languages such as Perl. Bear in mind that your abruptness--not even to
mention rudeness--only helps to stigmatize C as the language of
crotchety old men. Why give added ammunition to the Java generation who
argue that a new language is necessary for the modern world?

Perhaps one thing we could agree on is C's desirability and aptness for
system implementation in general. Why not contribute to serving that
end? It's a lot more satisfying than grandstanding, or hitting other
people over the head in a vain attempt to feel superior.

Mark

Nov 14 '05 #57
On Sat, 14 Feb 2004 16:08:08 -0700, in comp.lang.c , Mark Shelor
<ms*****@comcast.removeme.net> wrote:
Rich Dawes wrote:
pete wrote:

http://www.bluejo.demon.co.uk/poetry...ia/lurkers.htm
Thank you, Pete (and to Jo Walton) -- that made my night!

Absolutely side-splitting. Let's hope that Triumph The Insult Comic Dog
doesn't read it and suffer a nervous breakdown.

It's now abundantly clear, given the length and content of this thread,


FYI postings about topicality are topical.
that the comp.lang.c guardians of purity are themselves not averse to
off-topic posting.
The occasional bit of humour is acceptable.
They simply don't want others to enjoy the same privileges.
Bullsh*t.
Perhaps one thing we could agree on is C's desirability and aptness for
system implementation in general. Why not contribute to serving that
end? It's a lot more satisfying than grandstanding, or hitting other
people over the head in a vain attempt to feel superior.


Yeah, whatever. Another ottfopic nazi.

--
Mark McIntyre
CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
CLC readme: <http://www.angelfire.com/ms3/bchambless0/welcome_to_clc.html>
----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
Nov 14 '05 #58
Mark McIntyre wrote:
Yeah, whatever. Another ottfopic nazi.


Mark,

I live in a country that suffered from Nazi occupation in WWII.
Referring to someone as a nazi in an offhand way, as you do, is quite
deeply offensive, not only to the recipient, but also to people for whom
these terms hit a lot closer to home than you may think is possible. To
most Europeans, a nazi is not just some term coming from a sitcom, but a
name associated with perhaps the most despicable regime the world has
ever seen.

In other words, tone it down a bit, if you would.

Regards,
Sidney

Nov 14 '05 #59
Mark McIntyre wrote:
Yeah, whatever. Another ottfopic nazi.

If your purpose in using such an inflammatory term was to bring
unwarranted drama to your stunningly inconsequential post, you could
have found a far less offensive way to do it.

Make no mistake: you do not possess the comedic skills of Mel Brooks or
Jerry Seinfeld. Your remark was simply mean-spirited. Do you honestly
think you won any points by such a display?

Nov 14 '05 #60
On Sun, 15 Feb 2004 04:00:10 +0100, in comp.lang.c , Sidney Cadot
<si****@jigsaw.nl> wrote:
Mark McIntyre wrote:
Yeah, whatever. Another ottfopic nazi.


Mark,

I live in a country that suffered from Nazi occupation in WWII.
Referring to someone as a nazi in an offhand way, as you do, is quite
deeply offensive,


My apologies. It was meant to be an oblique reference to postings in this
and similar threads about the "topic nazis" that we're supposed to be round
here. Obviously I was too subtle. However IMHO you need to grow a thicker
skin if you take offense at the use of nazi in this context.

And BTW I /am/ a European. The UK is in europe too, or at least so some of
us think...
--
Mark McIntyre
CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
CLC readme: <http://www.angelfire.com/ms3/bchambless0/welcome_to_clc.html>
----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
Nov 14 '05 #61
On Sun, 15 Feb 2004 01:33:07 -0700, in comp.lang.c , Mark Shelor
<ms*****@comcast.removeme.net> wrote:
Mark McIntyre wrote:
Yeah, whatever. Another ottfopic nazi.
Make no mistake: you do not possess the comedic skills of Mel Brooks or
Jerry Seinfeld.


So sue me.
Your remark was simply mean-spirited. Do you honestly
think you won any points by such a display?


I'm not trying to win points. I'm trying to point out to you that your
behaviour is no better, and IMHO considerably worse, than the people you
are constantly attacking for being the "topic thought police" if you
prefer that term.

When you stick to making comments on C, you seem to have a clue. My advice
is to do that, and to drop the persistent drum rolls, hyperbole and snide
remarks about the regulars here.
--
Mark McIntyre
CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
CLC readme: <http://www.angelfire.com/ms3/bchambless0/welcome_to_clc.html>
----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
Nov 14 '05 #62
Mark McIntyre wrote:
On Sun, 15 Feb 2004 04:00:10 +0100, in comp.lang.c , Sidney Cadot
<si****@jigsaw.nl> wrote:

Mark McIntyre wrote:

Yeah, whatever. Another ottfopic nazi.
Mark,

I live in a country that suffered from Nazi occupation in WWII.
Referring to someone as a nazi in an offhand way, as you do, is quite
deeply offensive,

My apologies. It was meant to be an oblique reference to postings in this
and similar threads about the "topic nazis" that we're supposed to be round
here.


Yes, I didn't like the "topic nazis" reference either for one bit, but
at least this was coined by a non-regular, and it was used as a general
term. Your use directly pointed to Mark Shelor, which I feel takes it
one step too far.

But anyway... I'm glad you're sensible about it.
Obviously I was too subtle. However IMHO you need to grow a thicker
skin if you take offense at the use of nazi in this context.
Perhaps. On the other hand, perhaps the rest of the world could get a
bit more sensitive.
And BTW I /am/ a European. The UK is in europe too, or at least so some of
us think...


Best regards,
Sidney

Nov 14 '05 #63
Mark Shelor <ms*****@comcast.removeme.net> scribbled the following:
Mark McIntyre wrote:
Yeah, whatever. Another ottfopic nazi.
If your purpose in using such an inflammatory term was to bring
unwarranted drama to your stunningly inconsequential post, you could
have found a far less offensive way to do it. Make no mistake: you do not possess the comedic skills of Mel Brooks or
Jerry Seinfeld. Your remark was simply mean-spirited. Do you honestly
think you won any points by such a display?


Mark, I have had enough of you. Mark already apologised for his use of
the term "Nazi", and by the way, he wasn't the first to use it in this
thread. You've been letting it be in the subject line for quite some
time yourself.
About time I did this.
*PLONK*

--
/-- Joona Palaste (pa*****@cc.helsinki.fi) ------------- Finland --------\
\-- http://www.helsinki.fi/~palaste --------------------- rules! --------/
"You have moved your mouse, for these changes to take effect you must shut down
and restart your computer. Do you want to restart your computer now?"
- Karri Kalpio
Nov 14 '05 #64
Joona I Palaste wrote:
Mark, I have had enough of you. Mark already apologised for his use of
the term "Nazi", and by the way, he wasn't the first to use it in this
thread. You've been letting it be in the subject line for quite some
time yourself.
About time I did this.
*PLONK*

Well, in the event your killfile manages to let this through, you may
want to check the timestamps on the messages you're referring to. Mr.
McIntyre's apology was directed to Sidney, and it was posted more than
two hours after my message. So, your use of the word "already" is a bit
baffling.

Also, I did not initiate the thread on Topic Nazis, nor did anyone in
that thread refer to me as a Nazi. Moreover, this is an unmoderated
group, so it's not up to me to either allow or disallow that term to be
used in the subject line. If you bother to check, you'll see that I
posted a response to that thread with the subject line amended to "Topic
*****". Like Sidney, I don't consider the casual use of that term to be
particularly tasteful.

It's sad that you have to use a killfile to shield yourself from the truth.

Mark

Nov 14 '05 #65
On Sun, 15 Feb 2004 06:55:50 -0700, in comp.lang.c , Mark Shelor
<ms*****@comcast.removeme.net> wrote:
Well, in the event your killfile manages to let this through, you may
want to check the timestamps on the messages you're referring to.

You have quite a bit to learn about usenet. Its not IM you know. Theres' no
guarantee that messages arrive in order, in a timely manner, or even at
all.

Mr. McIntyre's apology was directed to Sidney, and it was posted more than
two hours after my message. So, your use of the word "already" is a bit
baffling.
FWIW I'd not seen your comment till after I replied to Sidney.
It's sad that you have to use a killfile to shield yourself from the truth.


Its sad that you can't see it. However I'm not killfiling you yet. Your C
comments sometimes make sense, and sometiems need corections, so I'm
sticking with you./
--
Mark McIntyre
CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
CLC readme: <http://www.angelfire.com/ms3/bchambless0/welcome_to_clc.html>
----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
Nov 14 '05 #66
Mark McIntyre wrote:
On Sun, 15 Feb 2004 06:55:50 -0700, in comp.lang.c , Mark Shelor
<ms*****@comcast.removeme.net> wrote:
Well, in the event your killfile manages to let this through, you may
want to check the timestamps on the messages you're referring to.


You have quite a bit to learn about usenet. Its not IM you know. Theres' no
guarantee that messages arrive in order, in a timely manner, or even at
all.

Thanks for the attention, but I think you should be delivering this
lecture to Joona I Palaste. He was the one making incorrect assumptions
about my post being made after apologies had been tendered.

Mr. McIntyre's apology was directed to Sidney, and it was posted more than
two hours after my message. So, your use of the word "already" is a bit
baffling.


FWIW I'd not seen your comment till after I replied to Sidney.

As Sidney pointed out, you aimed your use of the term "nazi" directly at
me, and I agree with Sidney that this took it one step too far. Yet,
you've offered no direct apology. The tone of your opening paragraph
signals that you're not in an apologetic mood at all. So, your FWIW is
not worth very much.

Nov 14 '05 #67
Mark McIntyre <ma**********@spamcop.net> scribbled the following:
On Sun, 15 Feb 2004 06:55:50 -0700, in comp.lang.c , Mark Shelor
<ms*****@comcast.removeme.net> wrote:
Well, in the event your killfile manages to let this through, you may
want to check the timestamps on the messages you're referring to.


Furthermore, in case you don't know it yet, the business with the word
"Nazi" was not the only reason I decided to killfile you, Mark Shelor.
I've fed up with you, and this was the last straw.

--
/-- Joona Palaste (pa*****@cc.helsinki.fi) ------------- Finland --------\
\-- http://www.helsinki.fi/~palaste --------------------- rules! --------/
"And according to Occam's Toothbrush, we only need to optimise the most frequent
instructions."
- Teemu Kerola
Nov 14 '05 #68
Mark Shelor <ms*****@comcast.removeme.net> wrote:
So, it's not quite fair to say that this newsgroup has the same
relation to the C language that a Star Trek convention does to rocket
science. But it IS demonstrably less helpful than newsgroups for other
languages such as Perl.
Demonstrably? Well, then, please demonstrate this - taking into account
the fact that I find this the most helpful computing group I know, and
the less so the more system-specific posts there are.
Perhaps one thing we could agree on is C's desirability and aptness for
system implementation in general. Why not contribute to serving that
end?


We do. Note - "in general", not "for Windows XP SP3 only".

Richard
Nov 14 '05 #69
On Sun, 15 Feb 2004 21:12:30 -0700, in comp.lang.c , Mark Shelor
<ms*****@comcast.removeme.net> wrote:
Mark McIntyre wrote:

Thanks for the attention, but I think you should be delivering this
lecture to Joona I Palaste. He was the one making incorrect assumptions
about my post being made after apologies had been tendered.
eh? Your own text, quoted below, makes it clear that you have some problems
w/ the concept.
Mr. McIntyre's apology was directed to Sidney, and it was posted more than
two hours after my message. So, your use of the word "already" is a bit
baffling.

you've offered no direct apology.


I did.
The tone of your opening paragraph
signals that you're not in an apologetic mood at all. So, your FWIW is
not worth very much.


*shrug*. YMMV but frankly I begin to think you're a troll.

--
Mark McIntyre
CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
CLC readme: <http://www.angelfire.com/ms3/bchambless0/welcome_to_clc.html>
----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
Nov 14 '05 #70
Mark McIntyre wrote:
eh? Your own text, quoted below, makes it clear that you have some problems
w/ the concept.
Mr. McIntyre's apology was directed to Sidney, and it was posted more than
two hours after my message. So, your use of the word "already" is a bit
baffling.
you've offered no direct apology.


I did.

You've used selective snipping, and thereby misrepresented the
situation. You directed the term "nazi" at me, not Sidney. Here's my
original text:

"As Sidney pointed out, you aimed your use of the term "nazi" directly
at me, and I agree with Sidney that this took it one step too far. Yet,
you've offered no direct apology. The tone of your opening paragraph
signals that you're not in an apologetic mood at all. So, your FWIW is
not worth very much."

So, an apology to Sidney, while laudable, is hardly sufficient.

*shrug*. YMMV but frankly I begin to think you're a troll.

Wonderful. It's a free world, so you can simply choose not to
contribute to this thread if you truly believe that.

Nov 14 '05 #71
Joona I Palaste wrote:
Furthermore, in case you don't know it yet, the business with the word
"Nazi" was not the only reason I decided to killfile you, Mark Shelor.
I've fed up with you, and this was the last straw.

OK, lil' Joona, you've slammed your bedroom door and are now ready for a
good pout. Once you've calmed down and are ready to talk again, perhaps
you can articulate some sound reasons that prompted you to issue the
deadly plonk.

With Parental Understanding and Good-Will, Mark

Nov 14 '05 #72
Richard Bos wrote:
Demonstrably? Well, then, please demonstrate this - taking into account
the fact that I find this the most helpful computing group I know, and
the less so the more system-specific posts there are.

Try visiting, say, comp.lang.perl.misc. The folks there are quite helpful.

Mark

Nov 14 '05 #73
On Mon, 16 Feb 2004 18:29:00 -0700, Mark Shelor wrote:
Richard Bos wrote:
Demonstrably? Well, then, please demonstrate this - taking into account
the fact that I find this the most helpful computing group I know, and
the less so the more system-specific posts there are.

Try visiting, say, comp.lang.perl.misc. The folks there are quite helpful.

So are the folks here, it's just that they try to keep this a useful forum
but _not_ allowing implementation specific questions.
I've said it before and I'll say it again: You are not going to succeed in
forcing comp.lang.c to be what you seem to want. The best you are going to
achieve is to alienate everyone that could help you. And when they
killfile you here they won't see your questions in another group where it
would be on-topic.

If you are serious about the need for a group for all encompassing
discussion about C including implementations and plattform specific
details you should work to create such a group instead of trying to change
an existing group into it.

I expect to see your proposal for comp.lang.c.everything (or some
similarly named group) posted to news.groups shortly. Failure to post such
a proposal would indicate that you don't really care that much about
having a forum for discussion of _all_ aspects of C, and are not willing
to do the work nessesary to create such a forum.

(You could ofcourse propose to create a charter for c.l.c that would make
everything on topic, but I believe you'd have far better chances of
success if you try to get a separate group created)

If you don't care enough to make such a proposal, but keep on complaining
here about why c.l.c should be a group like that I will believe that you
don't really care about finding a forum where your questions are welcome,
and that all this is merely you whining because your ego got hurt when you
where directed to post your question somewhere else.

--
NPV

"the large print giveth, and the small print taketh away"
Tom Waits - Step right up

Nov 14 '05 #74
Nils Petter Vaskinn wrote:
I've said it before and I'll say it again: You are not going to succeed in
forcing comp.lang.c to be what you seem to want. The best you are going to
achieve is to alienate everyone that could help you. And when they
killfile you here they won't see your questions in another group where it
would be on-topic.

Thank you, Nils, for taking the time to compose these obviously
heart-felt remarks. It's clear you're trying to be helpful, and I
appreciate that.

Am I trying to force c.l.c to be anything other than it is? No, that's
not my style, and such an endeavor would be pure folly and a source of
intense frustration. Yes, I'm disappointed in some of the behavior I've
seen, and yes I've said that I would prefer to see a greater sense of
receptiveness and helpfulness in this group. But I'm also realistic
enough to know that people will be as they are.

If you carefully review the remarks made in this thread, you'll see that
I'm not the one who's attempting to force a particular behavior.
Frankly, the not-so-subtle attempts at persuasion are moving in quite
the opposite direction.

If someone chooses to killfile me, that's their privilege. I certainly
regret that people would willingly choose to subject themselves to a
form of self-censorship. But if it helps to spare them frustration,
then it's probably a reasonable course of action.

Please make no mistake, though: if someone posts a remark to this thread
that either reflects a misunderstanding or makes a personal attack, I
will more than likely respond. And, if I detect that someone is
attempting to censor my remarks, I will almost certainly respond. I've
repeatedly advised that if people don't like this thread or believe it's
off-topic, then their best course of action would be to ignore it.

I expect to see your proposal for comp.lang.c.everything (or some
similarly named group) posted to news.groups shortly.

Is that an order? Perhaps you didn't intend it to come across that way,
but you could have certainly phrased the idea in a more respectful tone.
Failure to post such
a proposal would indicate that you don't really care that much about
having a forum for discussion of _all_ aspects of C, and are not willing
to do the work nessesary to create such a forum.

Or, that forming such a newsgroup would fall relatively low on my list
of life's priorites.

Would I like to see c.l.c have the same friendly atmosphere as
comp.lang.perl.misc? Yes, and I'd also like to have Liv Tyler show up
on my doorstep and say "I just dumped Royston Langdon, and I'm all yours
now, Big Boy", but that's simply not going to happen, now is it?

If you don't care enough to make such a proposal, but keep on complaining
here about why c.l.c should be a group like that I will believe that you
don't really care about finding a forum where your questions are welcome,
and that all this is merely you whining because your ego got hurt when you
where directed to post your question somewhere else.

I'm not complaining, but merely trying to encourage some of you to
display a bit more largesse when responding to others. And, if you look
at the civilized tone of my posts, especially compared to the vitriolic
remarks made by others, I believe you'll find your rather heavy-handed
attempt at psychoanalysis a bit misdirected.

Regards, Mark

Nov 14 '05 #75
On Tue, 17 Feb 2004 02:35:17 -0700, Mark Shelor wrote:
Nils Petter Vaskinn wrote:
If you carefully review the remarks made in this thread, you'll see that
I'm not the one who's attempting to force a particular behavior.
Frankly, the not-so-subtle attempts at persuasion are moving in quite
the opposite direction.
You are correct, both "sides" are trying to force a particular behaviour.

You are trying to get the group to behave in the way you want.

The group is trying to get you to behave in the way that most group
members already does.

I know who I think is beeing unreasonable.

If someone chooses to killfile me, that's their privilege. I certainly
regret that people would willingly choose to subject themselves to a
form of self-censorship. But if it helps to spare them frustration,
then it's probably a reasonable course of action.
Censorship is not allowing somone else to make a statement.
Self-censorship is deciding (for whatever reason) not to make a statement.
Choosing not to listen to someone elses statement has nothing to do with
censorship.
Please make no mistake, though: if someone posts a remark to this thread
that either reflects a misunderstanding or makes a personal attack, I
will more than likely respond. And, if I detect that someone is
attempting to censor my remarks, I will almost certainly respond. I've
repeatedly advised that if people don't like this thread or believe it's
off-topic, then their best course of action would be to ignore it.
The general rule is that topicality is always on topic. But the discussion
sprang from you (apparently) not accepting the answer ("ask somewhere
else") you got.

People have explained why they believe not redirecting offtopic questions
isn't their best course of action. (Then someone unaware of topicality
could answer and people would come back and the quality of clc would
degrade. People would post again since they didn't get an answer ... etc).
You could:

1. Explain why you think the questions should be on topic and why that
would be better for the group as a whole.
2. Explain why ignoring offtopic posts is better at preserving topicality
than redirecting those posts.
3. Accept things as they are.

You have as far as I know done neither. You have instead been claiming
that your way is better without explaining why it is better for the
members of this group.
I expect to see your proposal for comp.lang.c.everything (or some
similarly named group) posted to news.groups shortly.

Is that an order? Perhaps you didn't intend it to come across that way,
but you could have certainly phrased the idea in a more respectful tone.


No not an order. I said I "expect", that is given that you actually care
as much as your posts in this thread seems to indicate. The reason for the
"tone" is that when people complain about something and then fail to make
the obvious steps to change them I get a little impatient with them.
Failure to post such
a proposal would indicate that you don't really care that much about
having a forum for discussion of _all_ aspects of C, and are not willing
to do the work nessesary to create such a forum.

Or, that forming such a newsgroup would fall relatively low on my list
of life's priorites.


Then why does changing this newsgroup, a task that is probably harder
while achieving the same end result, appear to have a higher priority?
Would I like to see c.l.c have the same friendly atmosphere as
comp.lang.perl.misc? Yes, and I'd also like to have Liv Tyler show up
on my doorstep and say "I just dumped Royston Langdon, and I'm all yours
now, Big Boy", but that's simply not going to happen, now is it?


It has the same firiendly athmosphere, it's just that your insistence on
doing things your way means you fail to see the friendly side. clc isn't
unfriendly, it just refuses to discuss everything somehow related to C.

You can make clc be friendly to you by keeping on topic, and finding or
creating another forum for the questions that are offtopic here. If as you
say the topicality in clc is so horribly limiting people would flock
tou your new forum. As for Liv Tyler there is nothing (probably) you could
actively do to make that happen, so there is a difference between her and
clc.
If you don't care enough to make such a proposal, but keep on complaining
here about why c.l.c should be a group like that I will believe that you
don't really care about finding a forum where your questions are welcome,
and that all this is merely you whining because your ego got hurt when you
where directed to post your question somewhere else.

I'm not complaining, but merely trying to encourage some of you to
display a bit more largesse when responding to others. And, if you look
at the civilized tone of my posts, especially compared to the vitriolic
remarks made by others, I believe you'll find your rather heavy-handed
attempt at psychoanalysis a bit misdirected.


Your actions fit my definition of "complaining".

The vitriol is cased by people having seen threads like this one too
many times before:
1. Person appear out of nowhere.
2. Person posts a question that's offtopic.
3. Person is told that it's offtopic (and often told where it would be on
topic)
4. Person starts complaining that he should be allowed to post it, instead
of taking the advice and look for answers elsewhere.

The redirections may seem rough, but beeing polite is hard when a person
obviously hasn't followed usual usenet etiquette by:
1. Reading the faq, which would let him know what is on topic
2. Reading the group, to see what the group is about, which would probably
make him aware of what is on topic, and what to expect if he's posting
offtopic.

And if you read some of the rest of the group you may notice that the
"style" of the group isn't to sugercoat anything. If a posted piece of
code has a flaw people don't say "That may not work as you expected" they
say "That's wrong", and if they're in a good mood they tell why it's
wrong. The same style shines through in the redirects. CLC is about
accuracy and correctness, and packing the message in politeness detracts
from accuracy.

--
NPV

"the large print giveth, and the small print taketh away"
Tom Waits - Step right up

Nov 14 '05 #76
On Mon, 16 Feb 2004 18:29:00 -0700, Mark Shelor
<ms*****@comcast.removeme.net> wrote:
Richard Bos wrote:
Demonstrably? Well, then, please demonstrate this - taking into account
the fact that I find this the most helpful computing group I know, and
the less so the more system-specific posts there are.

Try visiting, say, comp.lang.perl.misc. The folks there are quite helpful.

Mark


Are they really good with questions about the C language? Should I
switch?

--
Al Balmer
Balmer Consulting
re************************@att.net
Nov 14 '05 #77
On Mon, 16 Feb 2004 17:58:09 -0700, in comp.lang.c , Mark Shelor
<ms*****@comcast.removeme.net> wrote:
you've offered no direct apology.
I did.


You've used selective snipping, and thereby misrepresented the
situation.


Nope. You've misunderstood it.
"As Sidney pointed out, you aimed your use of the term "nazi" directly
at me, and I agree with Sidney that this took it one step too far. Yet,
you've offered no direct apology. The tone of your opening paragraph
signals that you're not in an apologetic mood at all. So, your FWIW is
not worth very much."

So, an apology to Sidney, while laudable, is hardly sufficient.


I wasn't apologising to you, you dolt. I don't give a monkeys if I offended
you. Sidney I care about. Sidney's opinion matters.
*shrug*. YMMV but frankly I begin to think you're a troll.


Wonderful. It's a free world, so you can simply choose not to
contribute to this thread if you truly believe that.


Or I can start posting "Troll Alert" messages whenever I see you posting.
I'm still havering.

--
Mark McIntyre
CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
CLC readme: <http://www.angelfire.com/ms3/bchambless0/welcome_to_clc.html>
----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
Nov 14 '05 #78
Alan Balmer wrote:
On Mon, 16 Feb 2004 18:29:00 -0700, Mark Shelor
<ms*****@comcast.removeme.net> wrote:
Richard Bos wrote:
Demonstrably? Well, then, please demonstrate this - taking into account
the fact that I find this the most helpful computing group I know, and
the less so the more system-specific posts there are.


Try visiting, say, comp.lang.perl.misc. The folks there are quite helpful.


Are they really good with questions about the C language? Should I
switch?

What?

Oh, I get it. That was your idea of a joke, wasn't it?
Mark ;)

Nov 14 '05 #79
Mark McIntyre wrote:
I wasn't apologising to you, you dolt. I don't give a monkeys if I offended
you. Sidney I care about. Sidney's opinion matters.

Please don't strain yourself. I never accused you of apologizing to me.

If hurling epithets helps to lower your blood pressure, then go for it!
It's probably better that you're more concerned with your health than
with your stature.

Or I can start posting "Troll Alert" messages whenever I see you posting.
I'm still havering.

First it was the dreaded killfile. Now it's the deadly troll-alert.
When will my worries cease?

As I've endeavored to tell you repeatedly--with politeness and
respect--if you don't care for my comments on this thread or others,
then just ignore them instead of trying to exercise censorship. If you
continue to make inflammatory remarks, I'll more than likely continue to
respond to them.

Mark

Nov 14 '05 #80
Nils Petter Vaskinn wrote:
You are correct

Why ... thank you! ;)

both "sides" are trying to force a particular behaviour.

You are trying to get the group to behave in the way you want.

The group is trying to get you to behave in the way that most group
members already does.

I know who I think is beeing unreasonable.

Now now, Nils. I'm not interested in getting the group to behave the
way I want. Perhaps you don't see the distinction, but there's a BIG
difference between *preferring* that certain members of the group behave
a particular way, and attempting to *force* them to behave that way. I
think the latter is not only wrong-headed, but impractical.

If you carefully review the posts in this thread, you'll notice that
certain others are indeed attempting to force me to conform to their
particular view of this newsgroup. This is obvious from their remarks,
which at times range from merely intemperate to overtly aggressive and
hostile. From time-to-time, I have made somewhat barbed remarks, but
only in response to individuals who have overstepped themselves.

Censorship is not allowing somone else to make a statement.
Self-censorship is deciding (for whatever reason) not to make a statement.
Choosing not to listen to someone elses statement has nothing to do with
censorship.

Indeed. You're absolutely correct. If I choose to ignore someone
else's comments, that's not censorship. But if I go to the extent of
making sure that I never even see one of their comments again, that's
self-censorship. I'm not saying there's anything tragically bad about
that. It undoubtedly helps people who get upset at the mere existence
of things.

For example, much of American politics in the last few years has been
quite upsetting to me, and at times I feel like shutting off all news
channels. But, it's not particularly helpful to be left in the dark,
and eventually (let's hope) things will get better. So, I continue to
selectively watch the news, and try to avoid the more inflammatory channels.
1. Explain why you think the questions should be on topic and why that
would be better for the group as a whole.
2. Explain why ignoring offtopic posts is better at preserving topicality
than redirecting those posts.
3. Accept things as they are.

You have as far as I know done neither. You have instead been claiming
that your way is better without explaining why it is better for the
members of this group.

I personally believe that it's best not to try to govern things too
strictly in an unmoderated group. But, that's my belief. To try to
enforce such a belief would be obviously self-contradictory.

And, my *personal* view is that this group would be richer and more
broadly helpful if it oriented itself around the "computer language c"
instead of the "computer standard c". But these matters are ultimately
up to the newsgroup "in toto" to decide; they're not up to selected
groups of individuals to dictate, no matter how loud their voices.

From a practical viewpoint, however, it is far more effective in the
long-run for participants to simply ignore posts that they don't
consider topical. Then, if most or all participants feel the same way,
no responses will be issued to questions that are thereby de-facto
off-topic. This is the way to manifest a true consensus. Off-topic
posters will quickly realize the situation when they receive no
responses to their questions. And, they may even get the motivation at
that point to read the newsgroup FAQ if they can't understand the silence.

In my own case, I received helpful responses to the query on static
variables and performance. And, these responses stand boldly in the
thread, so the "lurkers support me in email" disbelievers will have to
remain silent this time. Were my query truly off-topic, this wouldn't
have happened. Given the length of (and diversity of responses on) this
thread, it's obvious that there's no de-facto consensus on what's
strictly topical. Some people are simply louder and more aggressive
than others.

No not an order. I said I "expect", that is given that you actually care
as much as your posts in this thread seems to indicate. The reason for the
"tone" is that when people complain about something and then fail to make
the obvious steps to change them I get a little impatient with them.

Yes, I get impatient myself, so I know the frustration. Heeding the
advice of Epictetus--to concern yourself only in matters within your
control--is very helpful in this regard. The behavior of others is not
within our control, particularly in an unmoderated group.

Mark

Nov 14 '05 #81
On Tue, 17 Feb 2004 14:49:36 -0700, in comp.lang.c , Mark Shelor
<ms*****@comcast.removeme.net> wrote:
As I've endeavored to tell you repeatedly--with politeness and
respect--if you don't care for my comments on this thread or others,
then just ignore them instead of trying to exercise censorship.
Good grief, I'm not trying to exercise censorship, I'm trying to point out
to you that you're driving on the wrong side of the road.

When you make topical remarks about C, I've no problem. I'm happy to read
them, you'll get comment on them from time to time if I feel you've
misexplained or erred.

When you make offtopic remarks, or inflammatory remarks, then expect to be
flamed. By the way, I consider childishness inflammatory - eg stuff like
"cue drumroll - the blessed Standard".
If you
continue to make inflammatory remarks, I'll more than likely continue to
respond to them.


*shrug*
--
Mark McIntyre
CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
CLC readme: <http://www.angelfire.com/ms3/bchambless0/welcome_to_clc.html>
----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
Nov 14 '05 #82
On Tue, 17 Feb 2004 14:49:36 -0700, in comp.lang.c , Mark Shelor
<ms*****@comcast.removeme.net> wrote:
First it was the dreaded killfile. Now it's the deadly troll-alert.
When will my worries cease?


Well, given that I suspect most of the Regulars have already killfiled you,
quite soon, Because soon nobody of any knowledge here will be reading your
posts, spotting mistakes, or answering your queries.

Its your lookout. You want CLC to be useful, abide by the rules. You want
to find it useless, ignore them.
--
Mark McIntyre
CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
CLC readme: <http://www.angelfire.com/ms3/bchambless0/welcome_to_clc.html>
----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
Nov 14 '05 #83
Mark McIntyre wrote:
Good grief, I'm not trying to exercise censorship, I'm trying to point out
to you that you're driving on the wrong side of the road.

And, that's all I'm trying to point out to you as well. So we're both
looking after each other's best interests. That's good.

When you make offtopic remarks, or inflammatory remarks, then expect to be
flamed. By the way, I consider childishness inflammatory - eg stuff like
"cue drumroll - the blessed Standard".

Perhaps it's a US/UK thing, like driving on the wrong side of the road.
But "(drum roll please) THE STANDARD" seems a bit less inflammatory
than "dolt" and "nazi".

Nov 14 '05 #84
Mark McIntyre wrote:
Well, given that I suspect most of the Regulars have already killfiled you,
quite soon, Because soon nobody of any knowledge here will be reading your
posts, spotting mistakes, or answering your queries.

Its your lookout. You want CLC to be useful, abide by the rules. You want
to find it useless, ignore them.

To borrow one of your favorite expressions,

*shrug*

Nov 14 '05 #85
Mark Shelor wrote:
.... snip ...
So, if your true desire is to protect the users (as you allude to in
your opening paragraph), then you have the full means to achieve that.


PLONK Your parents methods of rearing their offspring are suspect.

--
Chuck F (cb********@yahoo.com) (cb********@worldnet.att.net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home.att.net> USE worldnet address!
Nov 14 '05 #86
Mark Shelor <ms*****@comcast.removeme.net> wrote:
Look, the game is very simple.


It's not a game. It's a newsgroup. _We_ take it seriously, because it is
of serious help to us.

Richard
Nov 14 '05 #87
nrk
R. Rajesh Jeba Anbiah wrote:
Mark Shelor <ms*****@comcast.removeme.net> wrote in message
news:<rN********************@comcast.com>...
<snip>
And, my *personal* view is that this group would be richer and more
broadly helpful if it oriented itself around the "computer language c"
instead of the "computer standard c". But these matters are ultimately
up to the newsgroup "in toto" to decide; they're not up to selected
groups of individuals to dictate, no matter how loud their voices.

From a practical viewpoint, however, it is far more effective in the
long-run for participants to simply ignore posts that they don't
consider topical. Then, if most or all participants feel the same way,
no responses will be issued to questions that are thereby de-facto
off-topic. This is the way to manifest a true consensus. Off-topic
posters will quickly realize the situation when they receive no
responses to their questions. And, they may even get the motivation at
that point to read the newsgroup FAQ if they can't understand the
silence.

In my own case, I received helpful responses to the query on static
variables and performance. And, these responses stand boldly in the
thread, so the "lurkers support me in email" disbelievers will have to
remain silent this time. Were my query truly off-topic, this wouldn't
have happened. Given the length of (and diversity of responses on) this
thread, it's obvious that there's no de-facto consensus on what's
strictly topical. Some people are simply louder and more aggressive
than others.
I'm the idiot who read c.l.c almost frequently for about 4-years.
If I recall correct, many of your comments are sometimes implied by
many people and most of them are gone/plonked/few of them joined. The
interesting thing I have found here is many regulars are respecting
your views or at least listening to your views---which hardly happend
before.


Rajesh, it is unfortunate that inspite of spending around 4 years in
CLC, you haven't realized why the regulars are sticklers for topicality and
to questions related to the ANSIC C Standard. It is not because C is a toy
language. It is not because all (or even most) regulars here are old
people who don't want to dig any more. It simply has to do with the fact
that C is a very versatile and pervasive language. If one were to start
answering any and all questions merely on the basis that it involved C in
some way, the group will become well near useless. As they say, you can
either be a rather poor jack of all trades or be a good master of one.
This group is a good master at answering questions related to the C
language as it is described in the ANSI/ISO standards. By being so picky
about topicality, CLC actually does a favor to off-topic posters. By
forcing them to go to a domain that's richer with experts in their specific
issues it helps them get better quality help than they would get here.
Interestingly, in this thread I've found some good views about the
topicality of c.l.c. For a very longtime, I was thinking myself: K&R
says C is used to write OS/compilers/etc, but many people here why
flame if such questions came here. I was also thinking myself: is ISO
C is a toy language; sometimes ago someone posted a script for itoa()
claiming that it's a "pure ISO C" code; I used to wonder if there is
any compilers/OS written in ISO C; also I would think, this standard
is for the old people who don't like to dig more. And,... of course
yet I haven't got any valid answers.

The answers are right in front of your eyes. Don't wonder why you're not
able to see them as long as you have your eyes shut.

FWIW, Mark's original question was a marginal case IMO. For instance,
declaring his variable static inside a function has the effect that the
array is initialized exactly once. Making it non-static would change this.
Also, he could remove the static and try getting the same effect by passing
in the array in question as a parameter to the function. This way he gets
to maintain state across calls. He can even keep the same call interface
to the end-user by building a wrapper function that calls his inner
function in question. He could also try hinting to the compiler that
certain variables inside the function will be accessed very frequently by
making their storage class "register" (IMHO, most modern compilers
completely ignore this and do a better job of deciding how to allocate
registers).

Barring this, there might be issues as to how his compiler is compiling the
specific code in question. Those questions are best answered by experts
who know how his particular platform and implementation works.

There may also be algorithmic improvements that might benefit him more than
any of this kind of micro-optimizations. Again, that's best answered by
experts who reside elsewhere like comp.programming (or even cryptography
groups).

Mark simply refuses to accept that the generic *all*-platform-encompassing
answers to his question (barring algorithmic improvements) are borderline
useless and that he should perhaps restrict the scope to a handful of
architectures that dominate in today's world and optimize his
implementation for them. Once he does that, he can then ask experts in
those relevant architectures as to what he can do to optimize his code.

-nrk.

PS: Your book, section 4.2: The WAR style example of strcmp is atrocious
IMO. If you must insist on a single return, here's a clearer version of
strcmp:

int strcmp(const char *s1, const char *s2) {
while ( *s1 == *s2 && *s1 )
++s1, ++s2;

return *s1 - *s2;
}
With lots & lots of wishes.


--
Remove devnull for email
Nov 14 '05 #88
On Tue, 17 Feb 2004 17:29:58 -0700, in comp.lang.c , Mark Shelor
<ms*****@comcast.removeme.net> wrote:
Mark McIntyre wrote:
Well, given that I suspect most of the Regulars have already killfiled you,
quite soon, Because soon nobody of any knowledge here will be reading your
posts, spotting mistakes, or answering your queries.

Its your lookout. You want CLC to be useful, abide by the rules. You want
to find it useless, ignore them.

To borrow one of your favorite expressions,

*shrug*


And to borrow another *threadplonk*

--
Mark McIntyre
CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
CLC readme: <http://www.angelfire.com/ms3/bchambless0/welcome_to_clc.html>
----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
Nov 14 '05 #89
Richard Bos wrote:
Mark Shelor <ms*****@comcast.removeme.net> wrote:
Look, the game is very simple.


It's not a game. It's a newsgroup. _We_ take it seriously, because it is
of serious help to us.

Relax, Richard. It's just an expression.

Nov 14 '05 #90
CBFalconer wrote:
Mark Shelor wrote:
So, if your true desire is to protect the users (as you allude to in
your opening paragraph), then you have the full means to achieve that.


PLONK Your parents methods of rearing their offspring are suspect.

With respect, CBFalconer, resorting to ad-hominem attacks does not
strengthen your position.

Nov 14 '05 #91
nrk wrote:
FWIW, Mark's original question was a marginal case IMO. For instance,
declaring his variable static inside a function has the effect that the
array is initialized exactly once.

Bravo, nrk! And I DO mean that sincerely. You've used your knowledge
of the C programming language to analyze a situation that's not specific
to any one compiler implementation. And, below, you've suggested ways
to ameliorate the issues mentioned in my original post.

Making it non-static would change this.
Also, he could remove the static and try getting the same effect by passing
in the array in question as a parameter to the function. This way he gets
to maintain state across calls.

Now, on to the details. First bear in mind that there's no necessity
for the array (hereafter referred to as "the message schedule") to have
the storage class "static". The complete contents of the array are
built from scratch each time the function is executed, so the
prior-initialization property of static variables is not relevant in
this case. Furthermore, there's no need to maintain the values of the
message schedule across repeated function calls. In short, the array
can be made into an automatic variable with absolutely no change in the
observed behavior of the program.

But, making this variable automatic has the effect of dramatically
decreasing the function's performance on some platforms, while
significantly increasing it on others. So, the ideal solution would be
to find a consistent way to represent the message schedule such that the
function's performance is at least near-optimal on all platforms. The
goal here is to devise a simple, clean, portable solution that works
consistently, thereby avoiding the maintenance problems associated with
creating a series of #ifdef's that sense each underlying platform and
tweak the message schedule accordingly.

He could also try hinting to the compiler that
certain variables inside the function will be accessed very frequently by
making their storage class "register" (IMHO, most modern compilers
completely ignore this and do a better job of deciding how to allocate
registers).

Yes, your IMHO is correct, at least in this case. The compiler does a
much better job of optimizing compared to a manual use of the register
storage class.

Mark simply refuses to accept that the generic *all*-platform-encompassing
answers to his question (barring algorithmic improvements) are borderline
useless and that he should perhaps restrict the scope to a handful of
architectures that dominate in today's world and optimize his
implementation for them.

You are correct that I do refuse to accept your conjecture, but I also
respect your and other's right to regard this conjecture as fact. Your
interests center primarily on the formal properties of C programs as
they relate to the standard. I regard this as highly important as well,
but in the final analysis have to place primary emphasis on de-facto
portability, clean design, and high performance.

Once he does that, he can then ask experts in
those relevant architectures as to what he can do to optimize his code.

Having a fairly high comfort level with processor architectures and
assembly language programming, I'm not too concerned about how to
optimize performance for specific targets. What I am concerned about,
however, is proceeding to this step before everything possible has been
done to make the clean, portable, C-only version as efficient as possible.

No further algorithmic improvements are obvious at this point. In fact,
my C-only version has already attained the theoretical maximum SHA-1
throughput of 1.7 cycles per bit when built with the Intel compiler on
Pentium platforms. My guess is that only the most deft uses of the
assembler will be successful in squeezing out additional cycles, and any
real advantage of doing so may turn out to be marginal and inconsistent.

Mark

Nov 14 '05 #92
Mark McIntyre wrote:
And to borrow another *threadplonk*

I must confess ... that's a relief.

Nov 14 '05 #93
nrk wrote:
.... snip ...
PS: Your book, section 4.2: The WAR style example of strcmp is
atrocious IMO. If you must insist on a single return, here's a
clearer version of strcmp:

int strcmp(const char *s1, const char *s2) {
while ( *s1 == *s2 && *s1 )
++s1, ++s2;

return *s1 - *s2;
}


if (sizeof int == 1) that code has an incipient bug.

--
Chuck F (cb********@yahoo.com) (cb********@worldnet.att.net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home.att.net> USE worldnet address!
Nov 14 '05 #94
nrk <ra*********@devnull.verizon.net> wrote in message news:<Wi*******************@nwrddc01.gnilink.net>. ..
R. Rajesh Jeba Anbiah wrote:
Mark Shelor <ms*****@comcast.removeme.net> wrote in message
news:<rN********************@comcast.com>...
<snip>
And, my *personal* view is that this group would be richer and more
broadly helpful if it oriented itself around the "computer language c"
instead of the "computer standard c". But these matters are ultimately
up to the newsgroup "in toto" to decide; they're not up to selected
groups of individuals to dictate, no matter how loud their voices.

From a practical viewpoint, however, it is far more effective in the
long-run for participants to simply ignore posts that they don't
consider topical. Then, if most or all participants feel the same way,
no responses will be issued to questions that are thereby de-facto
off-topic. This is the way to manifest a true consensus. Off-topic
posters will quickly realize the situation when they receive no
responses to their questions. And, they may even get the motivation at
that point to read the newsgroup FAQ if they can't understand the
silence.

In my own case, I received helpful responses to the query on static
variables and performance. And, these responses stand boldly in the
thread, so the "lurkers support me in email" disbelievers will have to
remain silent this time. Were my query truly off-topic, this wouldn't
have happened. Given the length of (and diversity of responses on) this
thread, it's obvious that there's no de-facto consensus on what's
strictly topical. Some people are simply louder and more aggressive
than others.
I'm the idiot who read c.l.c almost frequently for about 4-years.
If I recall correct, many of your comments are sometimes implied by
many people and most of them are gone/plonked/few of them joined. The
interesting thing I have found here is many regulars are respecting
your views or at least listening to your views---which hardly happend
before.


Rajesh, it is unfortunate that inspite of spending around 4 years in
CLC, you haven't realized why the regulars are sticklers for topicality and
to questions related to the ANSIC C Standard. It is not because C is a toy
language. It is not because all (or even most) regulars here are old
people who don't want to dig any more. It simply has to do with the fact
that C is a very versatile and pervasive language. If one were to start
answering any and all questions merely on the basis that it involved C in
some way, the group will become well near useless. As they say, you can
either be a rather poor jack of all trades or be a good master of one.
This group is a good master at answering questions related to the C
language as it is described in the ANSI/ISO standards. By being so picky
about topicality, CLC actually does a favor to off-topic posters. By
forcing them to go to a domain that's richer with experts in their specific
issues it helps them get better quality help than they would get here.
Interestingly, in this thread I've found some good views about the
topicality of c.l.c. For a very longtime, I was thinking myself: K&R
says C is used to write OS/compilers/etc, but many people here why
flame if such questions came here. I was also thinking myself: is ISO
C is a toy language; sometimes ago someone posted a script for itoa()
claiming that it's a "pure ISO C" code; I used to wonder if there is
any compilers/OS written in ISO C; also I would think, this standard
is for the old people who don't like to dig more. And,... of course
yet I haven't got any valid answers.


The answers are right in front of your eyes. Don't wonder why you're not
able to see them as long as you have your eyes shut.


Respected Mr.Ram Kumar,

Thanks for your reply. But, it seems that you didn't understand
what I meant or vice-versa. As you know, we have already received
these explanations before, but this is not what I meant as the
valid/rational explanation. Perhaps I should rephrase my slugish
English with better one---which I don't know now. Anyway, thanks a lot
for your concerns.
<snip> PS: Your book, section 4.2: The WAR style example of strcmp is atrocious
IMO. If you must insist on a single return, here's a clearer version of
strcmp:

int strcmp(const char *s1, const char *s2) {
while ( *s1 == *s2 && *s1 )
++s1, ++s2;

return *s1 - *s2;
}


Thanks a lot for your interest in the quality of the book. As you
see, it has it's bug reporting corner; please don't take c.l.c as the
one. Thanks for your help; thanks for your understanding.

With lots & lots of wishes.

--
"I don't believe in the God who doesn't give me food, but shows me
heaven!" -- Swami Vivekanandha
If you live in USA, please support John Edwards.
http://guideme.itgo.com/atozofc/ - "A to Z of C" Project
Email: rrjanbiah-at-Y!com
Nov 14 '05 #95
R. Rajesh Jeba Anbiah wrote:
nrk <ra*********@devnull.verizon.net> wrote in message
news:<Wi*******************@nwrddc01.gnilink.net>. ..
<snip>
PS: Your book, section 4.2: The WAR style example of strcmp is
atrocious
IMO. If you must insist on a single return, here's a clearer version of
strcmp:

int strcmp(const char *s1, const char *s2) {
while ( *s1 == *s2 && *s1 )
++s1, ++s2;

return *s1 - *s2;
}


Thanks a lot for your interest in the quality of the book. As you
see, it has it's bug reporting corner; please don't take c.l.c as the
one. Thanks for your help; thanks for your understanding.


Since he /did/ post his "clearer version" to comp.lang.c, you should at
least get some feedback as to what is wrong with his correction. Do you see
the flaw? If not, then how do can you do quality control on the bug reports
you receive?

comp.lang.c is good at this sort of thing.

(Hint: the problem I can see has nothing to do with the loop.)

--
Richard Heathfield : bi****@eton.powernet.co.uk
"Usenet is a strange place." - Dennis M Ritchie, 29 July 1999.
C FAQ: http://www.eskimo.com/~scs/C-faq/top.html
K&R answers, C books, etc: http://users.powernet.co.uk/eton
Nov 14 '05 #96
Richard Heathfield wrote:

R. Rajesh Jeba Anbiah wrote:
nrk <ra*********@devnull.verizon.net> wrote in message
news:<Wi*******************@nwrddc01.gnilink.net>. ..
<snip>
PS: Your book, section 4.2: The WAR style example of strcmp is
atrocious
IMO. If you must insist on a single return, here's a clearer version of
strcmp:

int strcmp(const char *s1, const char *s2) {
while ( *s1 == *s2 && *s1 )
++s1, ++s2;

return *s1 - *s2;
}


Thanks a lot for your interest in the quality of the book. As you
see, it has it's bug reporting corner; please don't take c.l.c as the
one. Thanks for your help; thanks for your understanding.


Since he /did/ post his "clearer version" to comp.lang.c, you should at
least get some feedback as to what is wrong with his correction. Do you see
the flaw? If not, then how do can you do quality control on the bug reports
you receive?

comp.lang.c is good at this sort of thing.

(Hint: the problem I can see has nothing to do with the loop.)


Udefined behavior from integer overflow ?

--
pete
Nov 14 '05 #97
"pete" <pf*****@mindspring.com> wrote in message
news:40***********@mindspring.com...
Richard Heathfield wrote:

R. Rajesh Jeba Anbiah wrote:
nrk <ra*********@devnull.verizon.net> wrote in message
news:<Wi*******************@nwrddc01.gnilink.net>. ..
>

<snip>
> PS: Your book, section 4.2: The WAR style example of strcmp is
> atrocious
> IMO. If you must insist on a single return, here's a clearer version
> of strcmp:
>
> int strcmp(const char *s1, const char *s2) {
> while ( *s1 == *s2 && *s1 )
> ++s1, ++s2;
>
> return *s1 - *s2;
> }

Thanks a lot for your interest in the quality of the book. As you
see, it has it's bug reporting corner; please don't take c.l.c as the
one. Thanks for your help; thanks for your understanding.


Since he /did/ post his "clearer version" to comp.lang.c, you should at
least get some feedback as to what is wrong with his correction. Do you
see the flaw? If not, then how do can you do quality control on the bug
reports you receive?

comp.lang.c is good at this sort of thing.

(Hint: the problem I can see has nothing to do with the loop.)


Udefined behavior from integer overflow ?


That's one. But there is also the fact that it does not make comparisons
based on unsigned char values. [A requirement for the real strcmp().]

--
Peter
Nov 14 '05 #98
nrk
R. Rajesh Jeba Anbiah wrote:

<snip>
Respected Mr.Ram Kumar,

Please feel free to address me as just ram or nrk.
Thanks for your reply. But, it seems that you didn't understand
what I meant or vice-versa. As you know, we have already received
these explanations before, but this is not what I meant as the
valid/rational explanation. Perhaps I should rephrase my slugish
English with better one---which I don't know now. Anyway, thanks a lot
for your concerns.

Very well. I guess we have to just agree to disagree then.

<snip>
PS: Your book, section 4.2: The WAR style example of strcmp is
atrocious
IMO. If you must insist on a single return, here's a clearer version of
strcmp:

int strcmp(const char *s1, const char *s2) {
while ( *s1 == *s2 && *s1 )
++s1, ++s2;

return *s1 - *s2;
}
Thanks a lot for your interest in the quality of the book. As you
see, it has it's bug reporting corner; please don't take c.l.c as the
one. Thanks for your help; thanks for your understanding.


Apologies. I will send future reports through your web form. FWIW, this
seems to be a fine effort, although lacking a bit in polish (nothing that
can't be fixed by having enough eyes go through it).

-nrk.
With lots & lots of wishes.


--
Remove devnull for email
Nov 14 '05 #99
nrk
Richard Heathfield wrote:
R. Rajesh Jeba Anbiah wrote:
nrk <ra*********@devnull.verizon.net> wrote in message
news:<Wi*******************@nwrddc01.gnilink.net>. ..
<snip>
PS: Your book, section 4.2: The WAR style example of strcmp is
atrocious
IMO. If you must insist on a single return, here's a clearer version of
strcmp:

int strcmp(const char *s1, const char *s2) {
while ( *s1 == *s2 && *s1 )
++s1, ++s2;

return *s1 - *s2;
}


Thanks a lot for your interest in the quality of the book. As you
see, it has it's bug reporting corner; please don't take c.l.c as the
one. Thanks for your help; thanks for your understanding.


Since he /did/ post his "clearer version" to comp.lang.c, you should at
least get some feedback as to what is wrong with his correction. Do you
see the flaw? If not, then how do can you do quality control on the bug
reports you receive?

comp.lang.c is good at this sort of thing.

(Hint: the problem I can see has nothing to do with the loop.)


Ok, here's my take on this:

a) sizeof(int) > 1 for hosted implementations.
http://www.google.com/groups?selm=bu...unnews.cern.ch
So, integer overflow not an issue, yes?

b) Peter's concern still remains. So, does changing the last line to:

return *(unsigned char *)s1 - *(unsigned char *)s2;

make it alright?

-nrk.

--
Remove devnull for email
Nov 14 '05 #100

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

109
by: MSG | last post by:
Michel Bardiaux <michel.bardiaux@peaktime.be> wrote in message news:<G4idnfgZ0ZfCWbrdRVn2jQ@giganews.com>... > Mark Shelor wrote: > > > > > OK, Sidney, I am considering it. I can certainly...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.