473,322 Members | 1,352 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,322 software developers and data experts.

Faster for() loops?

Neo
Hi Folks,http://www.abarnett.demon.co.uk/tutorial.html#FASTFOR Page
states:for( i=0; i<10; i++){ ... }i loops through the values
0,1,2,3,4,5,6,7,8,9 If you don't care about the order of the loop counter,
you can do this instead: for( i=10; i--; ) { ... }Using this code, i loops
through the values 9,8,7,6,5,4,3,2,1,0, and the loop should be faster. This
works because it is quicker to process "i--" as the test condition, which
says "is i non-zero? If so, decrement it and continue.". For the original
code, the processor has to calculate "subtract i from 10. Is the result
non-zero? if so, increment i and continue.". In tight loops, this make a
considerable difference.
How far it holds true.. in the light of modern optimizing compilers? and
will it make a significant difference in case of embedded systems???

Thanks,
-Neo
"Do U really think, what U think real is really real?"
Nov 15 '05
109 4145
toby wrote:
Christian Bau wrote:
...
Well, if anyone writes code like

char* p = /* whatever */
do
{
/* somestuff */

} while (--p);


then they will get what they deserve!

Do you really think

for( p = /*whatever*/ ; p ; --p ){
/*somestuff*/
}

is any better?

Of course, the idea of counting a *pointer* down to NULL is rather
implausible in real code. Maybe you intended an integer variable.

Hold on there. Is there any guarantee that any amount of -- applications
eventually yield a null pointer? Could this loop forever or does it
summon nasal demons?

S.
Nov 15 '05 #51

Skarmander wrote:
toby wrote:
Christian Bau wrote:
...
Well, if anyone writes code like
> char* p = /* whatever */
> do
> {
> /* somestuff */
>
> } while (--p);

then they will get what they deserve!

Do you really think

for( p = /*whatever*/ ; p ; --p ){
/*somestuff*/
}

is any better?

Of course, the idea of counting a *pointer* down to NULL is rather
implausible in real code. Maybe you intended an integer variable.

Hold on there. Is there any guarantee that any amount of -- applications
eventually yield a null pointer? Could this loop forever or does it
summon nasal demons?


It's not guaranteed by the standard but on all implementations I know
of, it will eventually get there, unless of course, p isn't a multiple
of sizeof(*p) to begin with ;-) -- which can only arise through
naughtiness anyway.

S.


Nov 15 '05 #52

toby wrote:
Skarmander wrote:
toby wrote:
...
Do you really think

for( p = /*whatever*/ ; p ; --p ){
/*somestuff*/
}

is any better?

Of course, the idea of counting a *pointer* down to NULL is rather
implausible in real code. Maybe you intended an integer variable.
Hold on there. Is there any guarantee that any amount of -- applications
eventually yield a null pointer? Could this loop forever or does it
summon nasal demons?


It's not guaranteed by the standard but on all implementations I know
of, it will eventually get there, unless of course, p isn't a multiple
of sizeof(*p) to begin with ;-) -- which can only arise through
naughtiness anyway.


....Or unless a runtime exception (such as alignment or protection
fault) intervenes.

S.


Nov 15 '05 #53
"toby" <to**@telegraphics.com.au> writes:
Skarmander wrote:
toby wrote:
> Christian Bau wrote:
>
>>...
>>Well, if anyone writes code like
>>
>>
>>>> char* p = /* whatever */
>>>> do
>>>> {
>>>> /* somestuff */
>>>>
>>>> } while (--p);
>>
>>then they will get what they deserve!
>
>
> Do you really think
>
> for( p = /*whatever*/ ; p ; --p ){
> /*somestuff*/
> }
>
> is any better?
>
> Of course, the idea of counting a *pointer* down to NULL is rather
> implausible in real code. Maybe you intended an integer variable.

I suspect, based on his "then they will get what they deserve!", that
he really was referring to counting down a pointer.
Hold on there. Is there any guarantee that any amount of -- applications
eventually yield a null pointer? Could this loop forever or does it
summon nasal demons?


It's not guaranteed by the standard but on all implementations I know
of, it will eventually get there, unless of course, p isn't a multiple
of sizeof(*p) to begin with ;-) -- which can only arise through
naughtiness anyway.


It's more than "not guaranteed by the standard". Repeatedly
decrementing a pointer will invoke undefined behavior as soon as the
location it points to is no longer within the original object. It may
happen to "work" on many systems; such is the nature of undefined
behavior.

Incidentally, there's no requirement for p to be a multiple of
sizeof(*p) (unless sizeof(*p)==1, of course). If the designated type
is sufficiently large, its required alignment is almost certainly
smaller than its size (1024-byte structures don't have to be aligned
on 1024-byte boundaries). Even for smaller types, alignment
requirements are system-specific; there's nothing non-conforming about
allowing 2-byte or 4-byte integers to be allocated on odd addresses.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Nov 15 '05 #54
"Mark McIntyre" <ma**********@spamcop.net> wrote in message
news:84********************************@4ax.com...
On Wed, 28 Sep 2005 03:29:35 +0100, in comp.lang.c , "Joe Butler"
<ff***********@hotmail-spammers-paradise.com> wrote:
To Flash and Walter,


Are you clinically thick? You're /still/ top posting. In CLC thats the
height of rudeness. Stop it.


Who gives a shit? Why insult people over a minor matter of protocol? Sheesh!

Steve
http://www.fivetrees.com
Nov 15 '05 #55
"Richard Henry" <rp*****@home.com> wrote in message
news:3q************@individual.net...

A little alarm goes off in my brain every time I see an arithmetic
variable
(bit_ctr) used as the parameter of a logical expression (while).

The following line better expresses what I think you mean:
while (--bit_ctr != 0);
Whoa. As others have observed, --value/value-- as a boolean test is a common
idiom in C - check K&R's version of strcpy for an example.

There comes a point where one can be *too* explicit. I remember arguing over
a coding standards document with someone who insisted that all boolean tests
should be tested for equality with TRUE or FALSE (previously defined in
their own pet/preferred fashion, of course) - hence:

if ( boolean_flag == TRUE )

where I would have argued that:

if ( boolean_flag )

was safer, since it didn't depend on a specific value of TRUE. I pointed out
that his argument could be extended to:

if (((( boolean_flag == TRUE ) == TRUE ) == TRUE ) == TRUE ) // etc

which seemed dumb to me. He didn't understand the point.
And please don't let me get started with the use of NULL pointers in
similar
situations.


That's a whole different situation, and not relevant/applicable to the
above.

Steve
http://www.fivetrees.com
Nov 15 '05 #56
Steve at fivetrees wrote:
<snip>
There comes a point where one can be *too* explicit. I remember arguing over
a coding standards document with someone who insisted that all boolean tests
should be tested for equality with TRUE or FALSE (previously defined in
their own pet/preferred fashion, of course) - hence:

if ( boolean_flag == TRUE )

where I would have argued that:

if ( boolean_flag )

was safer, since it didn't depend on a specific value of TRUE.
Yeah. Provided TRUE wasn't defined as, you know, 0. Of course you'd have
to be stupid or perverse to do that. But you did say "defined in their
own pet/preferred fashion".
I pointed out that his argument could be extended to:

if (((( boolean_flag == TRUE ) == TRUE ) == TRUE ) == TRUE ) // etc

which seemed dumb to me. He didn't understand the point.

<snip>
Probably because (boolean_flag == TRUE) invokes == to yield a "C
boolean", which is by definition good to go in an if statement. No
further comparison necessary.

Mind you, I'm not encouraging or defending any of this. I'm not willing
to go any further than
typedef enum {false, true} bool;
But then, better use #define, or otherwise everything will break when
someone else defines the exact same enum. Sigh...

This is why I usually stick to 0, 1, and remembering when an int is used
as a pure boolean. "Extending" the language this way isn't worth it.
C99's bool is way overdue, but at least it's there.

S.
Nov 15 '05 #57

"Steve at fivetrees" <st***@NOSPAMTAfivetrees.com> wrote in message
news:k_********************@pipex.net...
"Richard Henry" <rp*****@home.com> wrote in message
news:3q************@individual.net...

A little alarm goes off in my brain every time I see an arithmetic
variable
(bit_ctr) used as the parameter of a logical expression (while).

The following line better expresses what I think you mean:
while (--bit_ctr != 0);
Whoa. As others have observed, --value/value-- as a boolean test is a

common idiom in C - check K&R's version of strcpy for an example.

There comes a point where one can be *too* explicit. I remember arguing over a coding standards document with someone who insisted that all boolean tests should be tested for equality with TRUE or FALSE (previously defined in
their own pet/preferred fashion, of course) - hence:

if ( boolean_flag == TRUE )

where I would have argued that:

if ( boolean_flag )

was safer, since it didn't depend on a specific value of TRUE. I pointed out that his argument could be extended to:

if (((( boolean_flag == TRUE ) == TRUE ) == TRUE ) == TRUE ) // etc

which seemed dumb to me. He didn't understand the point.
And please don't let me get started with the use of NULL pointers in
similar
situations.


That's a whole different situation, and not relevant/applicable to the
above.


The use of a boolean flag as the target parameter of a boolean expression is
of course completely appropriate. What I was whining about (I admit it is a
pointless whine) was using an arithmetic object, as in if(--index). What
that really means is "if the decremented index now equals 0" and just takes
advantage of the fact that the if operator (or while operator) in C is
hinged on the 0 value (from the ubiquitous JMPZ (or similar) operator, I
would suppose). While it is correct in C grammar, and will "always work",
it is not clear what you mean by that. The longer statement if(--index ==
0) (or in better style, if (0 == --index)) gets the same result, possible in
the same amount of machine code, and is explicit about its meaning.

As for pointers: I was not talking about decrementing pointers, but their
use in while( and if( statements as above. When you write

if(ptr)
{
//do something
}

what you really mean is

if(ptr != NULL)
{
//do something
}
Nov 15 '05 #58
Steve at fivetrees wrote:
"Richard Henry" <rp*****@home.com> wrote in message
news:3q************@individual.net...
A little alarm goes off in my brain every time I see an arithmetic
variable
(bit_ctr) used as the parameter of a logical expression (while).

The following line better expresses what I think you mean:
while (--bit_ctr != 0);

Whoa. As others have observed, --value/value-- as a boolean test is a common
idiom in C - check K&R's version of strcpy for an example.

There comes a point where one can be *too* explicit. I remember arguing over
a coding standards document with someone who insisted that all boolean tests
should be tested for equality with TRUE or FALSE (previously defined in
their own pet/preferred fashion, of course) - hence:

if ( boolean_flag == TRUE )

where I would have argued that:

if ( boolean_flag )

was safer, since it didn't depend on a specific value of TRUE.

<snip>

I'd agree the TRUE and FALSE instance are pedantic, but THIS form

if ( boolean_flag == RlyON )

can be safer and simpler, as any downstream logic inversion is
handled transparently.
Here, you have a common define setting RlyON is active Hi or Lo,
but the code is always clearer. ( and that may change with
PCB revision, for example )

Also note that not all compilers treat these the same !!

if ( boolean_flag == TRUE )
if ( boolean_flag )

-jg

Nov 15 '05 #59

Keith Thompson wrote:
"toby" <to**@telegraphics.com.au> writes:
Skarmander wrote:
toby wrote:
> Christian Bau wrote:
>
>>...
>>Well, if anyone writes code like
>>
>>
>>>> char* p = /* whatever */
>>>> do
>>>> {
>>>> /* somestuff */
>>>>
>>>> } while (--p);
>>
>>then they will get what they deserve!
>
>
> Do you really think
>
> for( p = /*whatever*/ ; p ; --p ){
> /*somestuff*/
> }
>
> is any better?
>
> Of course, the idea of counting a *pointer* down to NULL is rather
> implausible in real code. Maybe you intended an integer variable.
I suspect, based on his "then they will get what they deserve!", that
he really was referring to counting down a pointer.
Hold on there. Is there any guarantee that any amount of -- applications
eventually yield a null pointer? Could this loop forever or does it
summon nasal demons?
It's not guaranteed by the standard but on all implementations I know
of, it will eventually get there ...


It's more than "not guaranteed by the standard". Repeatedly
decrementing a pointer will invoke undefined behavior as soon as the
location it points to is no longer within the original object. It may
happen to "work" on many systems; ...


Which is all I intended to say. The code snippet made no real sense as
a pointer. I think the poster may have meant an integral type.

Incidentally, there's no requirement for p to be a multiple of
sizeof(*p) (unless sizeof(*p)==1, of course). ...
Agreeed there is no 'requirement', but as I said, the loop will not
actually terminate at NULL (on implementations where it happens to work
at all -- i.e. most of the ones we know) unless that condition is met.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.


Nov 15 '05 #60
>In article <48********************************@4ax.com>,
Mark McIntyre <ma**********@spamcop.net> wrote:
For what its worth, arguments based on threading are bunk. Thread
members arrive out-of-order, not at all, and disappear from servers.

In article <missing@missing>, missing wrote:And sometimes the intermediates go missing entirely.


As in this case.

(Which, I admit, I faked. :-) But I have read followups to which
the ancestor was missing, and in many cases, the followup was
incomprehensible as a result.)
--
In-Real-Life: Chris Torek, Wind River Systems
Salt Lake City, UT, USA (40°39.22'N, 111°50.29'W) +1 801 277 2603
email: forget about it http://web.torek.net/torek/index.html
Reading email is like searching for food in the garbage, thanks to spammers.
Nov 15 '05 #61
Robert Scott wrote:
On 28 Sep 2005 09:30:44 +0200, David Brown
<da***@westcontrol.removethisbit.com> wrote:

Top-posting is strongly discouraged in comp.arch.embedded as well...

It amazes me how some people can claim to speak for the whole group
with no documentation at all. I, for one, appreciate top-posting when
it is appropriate. At least I won't claim to speak for a whole group
who did not elect me to represent them.
-Robert Scott
Ypsilanti, Michigan


I can't claim to speak for everyone in the group, obviously. Every
newsgroup post has an implicit "IMHO" attached. But I think it's a fair
summary of the opinions of the group, or at least of those who post
regularly. And very few people object to top-posting when it is
appropriate - it is just the definition of "appropriate" that they
disagree on...

Anyway, the key point with posting etiquette is to be (reasonably)
polite and informative, and to remember it's a conversation between real
people. If, as is normally the case, top-posting makes it unnecessarily
harder for people to follow the sense of a post, then it is impolite and
uninformative, just like posting in SMS or all caps. If top-posting
makes a reply easier to read, then it is appropriate (although usually
snipping would be far better).
Nov 15 '05 #62
Jim Granville wrote:

Steve at fivetrees wrote:
"Richard Henry" <rp*****@home.com> wrote in message
news:3q************@individual.net...
A little alarm goes off in my brain every time I see an arithmetic
variable
(bit_ctr) used as the parameter of a logical expression (while).

The following line better expresses what I think you mean:
while (--bit_ctr != 0);

Whoa. As others have observed, --value/value-- as a boolean test is a common
idiom in C - check K&R's version of strcpy for an example.

There comes a point where one can be *too* explicit. I remember arguing over
a coding standards document with someone who insisted that all boolean tests
should be tested for equality with TRUE or FALSE (previously defined in
their own pet/preferred fashion, of course) - hence:

if ( boolean_flag == TRUE )

where I would have argued that:

if ( boolean_flag )

was safer, since it didn't depend on a specific value of TRUE.

<snip>

I'd agree the TRUE and FALSE instance are pedantic, but THIS form

if ( boolean_flag == RlyON )

can be safer and simpler, as any downstream logic inversion is
handled transparently.
Here, you have a common define setting RlyON is active Hi or Lo,
but the code is always clearer. ( and that may change with
PCB revision, for example )

Also note that not all compilers treat these the same !!

if ( boolean_flag == TRUE )
if ( boolean_flag )


I prefer to compare Boolean values against zero or FALSE.

if (boolean_flag != 0)

means just exactly the same thing as

if ( boolean_flag )

and should be easy enough to read.

--
pete
Nov 15 '05 #63
pete wrote:

Jim Granville wrote:

Steve at fivetrees wrote:
"Richard Henry" <rp*****@home.com> wrote in message
news:3q************@individual.net...

>A little alarm goes off in my brain every time I see an arithmetic
>variable
>(bit_ctr) used as the parameter of a logical expression (while).
>
>The following line better expresses what I think you mean:
> while (--bit_ctr != 0);
Whoa. As others have observed, --value/value-- as a boolean test is a common
idiom in C - check K&R's version of strcpy for an example.

There comes a point where one can be *too* explicit. I remember arguing over
a coding standards document with someone who insisted that all boolean tests
should be tested for equality with TRUE or FALSE (previously defined in
their own pet/preferred fashion, of course) - hence:

if ( boolean_flag == TRUE )

where I would have argued that:

if ( boolean_flag )

was safer, since it didn't depend on a specific value of TRUE.

<snip>

I'd agree the TRUE and FALSE instance are pedantic, but THIS form

if ( boolean_flag == RlyON )

can be safer and simpler, as any downstream logic inversion is
handled transparently.
Here, you have a common define setting RlyON is active Hi or Lo,
but the code is always clearer. ( and that may change with
PCB revision, for example )

Also note that not all compilers treat these the same !!

if ( boolean_flag == TRUE )
if ( boolean_flag )


I prefer to compare Boolean values against zero or FALSE.

if (boolean_flag != 0)


Actually, with values of a boolean nature,
I prefer to do it Steve's way:

#include <ctype.h>

int a_toi(const char *nptr)
{
int n;

n = 0;
while (isspace(*nptr)) {
++nptr;
}
if (*nptr != '-') {
if (*nptr == '+') {
++nptr;
}
while (isdigit(*nptr)) {
n = 10 * n - '0' + *nptr++;
}
} else {
++nptr;
while (isdigit(*nptr)) {
n = 10 * n + '0' - *nptr++;
}
}
return n;
}
--
pete
Nov 15 '05 #64
Steve at fivetrees wrote:
"Mark McIntyre" <ma**********@spamcop.net> wrote in message
news:84********************************@4ax.com...
On Wed, 28 Sep 2005 03:29:35 +0100, in comp.lang.c , "Joe Butler"
<ff***********@hotmail-spammers-paradise.com> wrote:
To Flash and Walter,


Are you clinically thick? You're still top posting. In CLC thats the
height of rudeness. Stop it.


Who gives a shit? Why insult people over a minor matter of protocol?
Sheesh!

Steve
http://www.fivetrees.com

Don't disrespect our group wishes.

*plonk*

Brian
--
Please quote enough of the previous message for context. To do so from
Google, click "show options" and use the Reply shown in the expanded
header.
Nov 15 '05 #65
Jim Granville <no*****@designtools.co.nz> writes:
Steve at fivetrees wrote:
"Richard Henry" <rp*****@home.com> wrote in message
news:3q************@individual.net...
A little alarm goes off in my brain every time I see an arithmetic
variable
(bit_ctr) used as the parameter of a logical expression (while).

The following line better expresses what I think you mean:
while (--bit_ctr != 0); Whoa. As others have observed, --value/value-- as a boolean test is
a common idiom in C - check K&R's version of strcpy for an example.
There comes a point where one can be *too* explicit. I remember
arguing over a coding standards document with someone who insisted
that all boolean tests should be tested for equality with TRUE or
FALSE (previously defined in their own pet/preferred fashion, of
course) - hence:
if ( boolean_flag == TRUE )
where I would have argued that:
if ( boolean_flag )
was safer, since it didn't depend on a specific value of TRUE.

<snip>

I'd agree the TRUE and FALSE instance are pedantic, but THIS form

if ( boolean_flag == RlyON )

can be safer and simpler, as any downstream logic inversion is
handled transparently.
Here, you have a common define setting RlyON is active Hi or Lo,
but the code is always clearer. ( and that may change with
PCB revision, for example )


I'll ignore, for now, the built-in type _Bool and the standard header
<stdbool.h> introduced in C99.

A value used as a condition in C is treated as false if it's equal to
zero, true if it's non-zero. It's not 0 vs. 1, it's 0 vs. anything
other than 0.

If your variable "boolean_flag" is something other than zero-is-false,
non-zero-is-true, it shouldn't be called "boolean_flag".

Assuming boolean_flag is a proper condition, "boolean_flag == TRUE"
isn't just pedantic, it's positively dangerous. The relational
operators always yield 0 or 1, but other boolean expressions can have
any non-zero value; for example, the is*() functions in <ctype.h>
return 0 for false, but can return any arbitrary non-zero value for
true.
Also note that not all compilers treat these the same !!

if ( boolean_flag == TRUE )
if ( boolean_flag )


Any compiler that does treat them the same is badly broken (unless the
compiler is able to prove that the value of boolean_flag is either 0
or 1).

This is a different issue from using something that's not a
boolean flag as a condition, such as "if (!ptr)" rather than
"if (ptr == NULL)", or "if (count)" rather than "if (count != 0)".
I prefer the more explicit comparison, but both forms are perfectly
valid and equally safe.

See also section 9 of the C FAQ.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Nov 15 '05 #66
"Default User" <de***********@yahoo.com> wrote in message
news:3q************@individual.net...
Steve at fivetrees wrote:
"Mark McIntyre" <ma**********@spamcop.net> wrote in message
news:84********************************@4ax.com...
> On Wed, 28 Sep 2005 03:29:35 +0100, in comp.lang.c , "Joe Butler"
><ff***********@hotmail-spammers-paradise.com> wrote:
>
> > To Flash and Walter,
>
> Are you clinically thick? You're still top posting. In CLC thats the
> height of rudeness. Stop it.


Who gives a shit? Why insult people over a minor matter of protocol?
Sheesh!


Don't disrespect our group wishes.


Oh, so calling someone "clinically thick" over something so trivial is
somehow respectful?

Show some respect for others. *Then* you'd be entitled to talk to me on the
subject.

Steve
http://www.fivetrees.com
Nov 15 '05 #67
'king 'ell - Some people.

If you are going to "*plonk*", why do you have to broadcast it. That's the
equivalent of putting your fingers in your ears and going, baaaa! bblaah!
I'm not listening!

Plonker.
"Default User" <de***********@yahoo.com> wrote in message
news:3q************@individual.net...
Steve at fivetrees wrote:
"Mark McIntyre" <ma**********@spamcop.net> wrote in message
news:84********************************@4ax.com...
On Wed, 28 Sep 2005 03:29:35 +0100, in comp.lang.c , "Joe Butler"
<ff***********@hotmail-spammers-paradise.com> wrote:

> To Flash and Walter,

Are you clinically thick? You're still top posting. In CLC thats the
height of rudeness. Stop it.


Who gives a shit? Why insult people over a minor matter of protocol?
Sheesh!

Steve
http://www.fivetrees.com

Don't disrespect our group wishes.

*plonk*

Brian
--
Please quote enough of the previous message for context. To do so from
Google, click "show options" and use the Reply shown in the expanded
header.

Nov 15 '05 #68
"Keith Thompson" <ks***@mib.org> wrote in message
news:ln************@nuthaus.mib.org...

Assuming boolean_flag is a proper condition, "boolean_flag == TRUE"
isn't just pedantic, it's positively dangerous.


Exactly my point. Thanks for making it clearer than I managed to ;).

Steve
http://www.fivetrees.com

Nov 15 '05 #69

"Keith Thompson" <ks***@mib.org> wrote in message
news:ln************@nuthaus.mib.org...
Jim Granville <no*****@designtools.co.nz> writes:
Steve at fivetrees wrote:
"Richard Henry" <rp*****@home.com> wrote in message
news:3q************@individual.net...

A little alarm goes off in my brain every time I see an arithmetic
variable
(bit_ctr) used as the parameter of a logical expression (while).

The following line better expresses what I think you mean:
while (--bit_ctr != 0);
Whoa. As others have observed, --value/value-- as a boolean test is
a common idiom in C - check K&R's version of strcpy for an example.
There comes a point where one can be *too* explicit. I remember
arguing over a coding standards document with someone who insisted
that all boolean tests should be tested for equality with TRUE or
FALSE (previously defined in their own pet/preferred fashion, of
course) - hence:
if ( boolean_flag == TRUE )
where I would have argued that:
if ( boolean_flag )
was safer, since it didn't depend on a specific value of TRUE. <snip>

I'd agree the TRUE and FALSE instance are pedantic, but THIS form

if ( boolean_flag == RlyON )

can be safer and simpler, as any downstream logic inversion is
handled transparently.
Here, you have a common define setting RlyON is active Hi or Lo,
but the code is always clearer. ( and that may change with
PCB revision, for example )


I'll ignore, for now, the built-in type _Bool and the standard header
<stdbool.h> introduced in C99.

A value used as a condition in C is treated as false if it's equal to
zero, true if it's non-zero. It's not 0 vs. 1, it's 0 vs. anything
other than 0.

If your variable "boolean_flag" is something other than zero-is-false,
non-zero-is-true, it shouldn't be called "boolean_flag".

Assuming boolean_flag is a proper condition, "boolean_flag == TRUE"
isn't just pedantic, it's positively dangerous. The relational
operators always yield 0 or 1, but other boolean expressions can have
any non-zero value; for example, the is*() functions in <ctype.h>
return 0 for false, but can return any arbitrary non-zero value for
true.
Also note that not all compilers treat these the same !!

if ( boolean_flag == TRUE )
if ( boolean_flag )


Any compiler that does treat them the same is badly broken (unless the
compiler is able to prove that the value of boolean_flag is either 0
or 1).

This is a different issue from using something that's not a
boolean flag as a condition, such as "if (!ptr)" rather than
"if (ptr == NULL)", or "if (count)" rather than "if (count != 0)".
I prefer the more explicit comparison, but both forms are perfectly
valid and equally safe.

See also section 9 of the C FAQ.

--
Keith Thompson (The_Other_Keith) ks***@mib.org

<http://www.ghoti.net/~kst> San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst> We must do something. This is something. Therefore, we must do this.

Nov 15 '05 #70
"Steve at fivetrees" <st***@NOSPAMTAfivetrees.com> writes:
"Default User" <de***********@yahoo.com> wrote in message
news:3q************@individual.net...
Steve at fivetrees wrote:
"Mark McIntyre" <ma**********@spamcop.net> wrote in message
news:84********************************@4ax.com...
> On Wed, 28 Sep 2005 03:29:35 +0100, in comp.lang.c , "Joe Butler"
><ff***********@hotmail-spammers-paradise.com> wrote:
>
> > To Flash and Walter,
>
> Are you clinically thick? You're still top posting. In CLC thats the
> height of rudeness. Stop it.

Who gives a shit? Why insult people over a minor matter of protocol?
Sheesh!


Don't disrespect our group wishes.


Oh, so calling someone "clinically thick" over something so trivial is
somehow respectful?

Show some respect for others. *Then* you'd be entitled to talk to me on the
subject.


I suggest you take a look at this thread to see what really happened.

Joe Butler was asked not to top-post. He replied with a top-posted
followup. Someone else again reminded him not to top-post. His
response, in article <43***********************@news.zen.co.uk>, was,
and I quote, "prick." (and it was, of course, top-posted).

There are good reasons for our convention (here in comp.lang.c) of
discouraging top-posting; I won't repeat them here. There are also
good reasons for not insulting people who are offering good advice.
If you've come into the middle of this discussion, it might not be
clear what's going on; groups.google.com can help you.

I suggest we drop this. I don't believe there are any relevant points
that haven't already been made.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Nov 15 '05 #71
In article <43***********************@news.xs4all.nl>,
Skarmander <in*****@dontmailme.com> wrote:
toby wrote:
Christian Bau wrote:
...
Well, if anyone writes code like
> char* p = /* whatever */
> do
> {
> /* somestuff */
>
> } while (--p);

then they will get what they deserve!

Do you really think

for( p = /*whatever*/ ; p ; --p ){
/*somestuff*/
}

is any better?

Of course, the idea of counting a *pointer* down to NULL is rather
implausible in real code. Maybe you intended an integer variable.

Hold on there. Is there any guarantee that any amount of -- applications
eventually yield a null pointer? Could this loop forever or does it
summon nasal demons?


Well, "toby" snipped too much of the previous post. What I wrote makes
only sense when you can read the bits that he removed as well.

(Hint: The last line of a joke is usually not very funny if the
beginning is missing).
Nov 15 '05 #72
In article <ln************@nuthaus.mib.org>,
Keith Thompson <ks***@mib.org> wrote:
"toby" <to**@telegraphics.com.au> writes:
Skarmander wrote:
toby wrote:
> Christian Bau wrote:
>
>>...
If you could see what toby replaced with three dots, then my post would
have made much more sense.
>>Well, if anyone writes code like
>>
>>
>>>> char* p = /* whatever */
>>>> do
>>>> {
>>>> /* somestuff */
>>>>
>>>> } while (--p);
>>
>>then they will get what they deserve!
>
>
> Do you really think
>
> for( p = /*whatever*/ ; p ; --p ){
> /*somestuff*/
> }
>
> is any better?
>
> Of course, the idea of counting a *pointer* down to NULL is rather
> implausible in real code. Maybe you intended an integer variable.


I suspect, based on his "then they will get what they deserve!", that
he really was referring to counting down a pointer.


I suspect that "toby" didn't get the joke that was there before he
snipped the part that I had been responding to.
Nov 15 '05 #73
"Keith Thompson" <ks***@mib.org> wrote in message
news:ln************@nuthaus.mib.org...

Joe Butler was asked not to top-post. He replied with a top-posted
followup. Someone else again reminded him not to top-post. His
response, in article <43***********************@news.zen.co.uk>, was,
and I quote, "prick." (and it was, of course, top-posted).
Ah. Mea culpa. If the disrespect I reacted to was in response to insulting
behaviour, then I apologise for leaping to the defence of the offender.
There are good reasons for our convention (here in comp.lang.c) of
discouraging top-posting; I won't repeat them here. There are also
good reasons for not insulting people who are offering good advice.


Fully agreed.

FWIW: I understand and agree with the reasons for discouraging top-posting.
However I've grown far more tired of the flamefests that result from
top-posting than of top-posting itself. My patience ran out when I saw what
I thought was an over-the-top response. I was wrong; I apologise.

Steve
http://www.fivetrees.com
Nov 15 '05 #74
In article <11**********************@z14g2000cwz.googlegroups .com>,
"toby" <to**@telegraphics.com.au> wrote:
Keith Thompson wrote:
"toby" <to**@telegraphics.com.au> writes:
Skarmander wrote:
> toby wrote:
> > Christian Bau wrote:
> >
> >>...
> >>Well, if anyone writes code like
> >>
> >>
> >>>> char* p = /* whatever */
> >>>> do
> >>>> {
> >>>> /* somestuff */
> >>>>
> >>>> } while (--p);
> >>
> >>then they will get what they deserve!
> >
> >
> > Do you really think
> >
> > for( p = /*whatever*/ ; p ; --p ){
> > /*somestuff*/
> > }
> >
> > is any better?
> >
> > Of course, the idea of counting a *pointer* down to NULL is rather
> > implausible in real code. Maybe you intended an integer variable.


I suspect, based on his "then they will get what they deserve!", that
he really was referring to counting down a pointer.
> Hold on there. Is there any guarantee that any amount of -- applications
> eventually yield a null pointer? Could this loop forever or does it
> summon nasal demons?

It's not guaranteed by the standard but on all implementations I know
of, it will eventually get there ...


It's more than "not guaranteed by the standard". Repeatedly
decrementing a pointer will invoke undefined behavior as soon as the
location it points to is no longer within the original object. It may
happen to "work" on many systems; ...


Which is all I intended to say. The code snippet made no real sense as
a pointer. I think the poster may have meant an integral type.


I think my post was mangled by some stupid idiot with a room temperature
IQ. And I mean Celsius.
Nov 15 '05 #75
If you want a debate about top posting change the subject line so everyone who doesn't care if it is cross posted top posted, middle posted, bottom posted , written in one line or in HTML can filter out the noise.

Default User wrote:
Joe Butler wrote:
OK, point taken.


[snip]
"Flash Gordon" <sp**@flash-gordon.me.uk> wrote in message
news:sm************@brenda.flash-gordon.me.uk...
Joe Butler wrote:

Don't top post. Replies belong after the text you are replying to.


You need to get the other point, the one about not top-posting.

Brian


Nov 15 '05 #76
Oh dreidel, dreidel, dreidel
I made it out of clay
And when it's dry and ready
Then dreidel I shall play!

It has a lovely body
With legs so short and thin
And when my dreidel's tired
It drops and then I win!

Oh dreidel, dreidel, dreidel
I made it out of clay
And when it's dry and ready
Then dreidel I shall play!

My dreidel's always playful
It loves to dance and spin
A happy game of dreidel
Come play now, let's begin!

Oh dreidel, dreidel, dreidel
I made it out of clay
And when it's dry and ready
Then dreidel I shall play!
Nov 15 '05 #77
Let's put this into perspective.

Althought I don't know how to verify this, I suspect many 100s, perhaps
1000s, of people read these posts.

Only 2 or 3 people told me not to top post. That's 3 out of 1000? 3 out of
10,000? Who knows. That suggests to me that the vast majority of people
don't give a damn. Probably, like me, the vast majority are easily able to
deal with all the forms of posting and it is, therefore, not an issue for
them.

I understand that top-posting annoys some people. For me, when someone
who's only contribution is to butt in with something along the lines of
"space corp. directive one ex delta nine has been violated", that is
infinitely more annoying than any other person's posting style.

The only input 'Default User' (prick) gave at that point was, "You need to
get the other point, the one about not top-posting". If Default User had
any sense, he would have realised that I had chosen to ignore the advice
about top-posting, that it was not the first time that I had been told and,
therefore, it was a pretty pointless exercise to step in at that point.

Sincere regards to everyone.
"Keith Thompson" <ks***@mib.org> wrote in message
news:ln************@nuthaus.mib.org...
"Steve at fivetrees" <st***@NOSPAMTAfivetrees.com> writes:
"Default User" <de***********@yahoo.com> wrote in message
news:3q************@individual.net...
Steve at fivetrees wrote:

"Mark McIntyre" <ma**********@spamcop.net> wrote in message
news:84********************************@4ax.com...
> On Wed, 28 Sep 2005 03:29:35 +0100, in comp.lang.c , "Joe Butler"
><ff***********@hotmail-spammers-paradise.com> wrote:
>
> > To Flash and Walter,
>
> Are you clinically thick? You're still top posting. In CLC thats the
> height of rudeness. Stop it.

Who gives a shit? Why insult people over a minor matter of protocol?
Sheesh!

Don't disrespect our group wishes.
Oh, so calling someone "clinically thick" over something so trivial is
somehow respectful?

Show some respect for others. *Then* you'd be entitled to talk to me on the subject.


I suggest you take a look at this thread to see what really happened.

Joe Butler was asked not to top-post. He replied with a top-posted
followup. Someone else again reminded him not to top-post. His
response, in article <43***********************@news.zen.co.uk>, was,
and I quote, "prick." (and it was, of course, top-posted).

There are good reasons for our convention (here in comp.lang.c) of
discouraging top-posting; I won't repeat them here. There are also
good reasons for not insulting people who are offering good advice.
If you've come into the middle of this discussion, it might not be
clear what's going on; groups.google.com can help you.

I suggest we drop this. I don't believe there are any relevant points
that haven't already been made.

--
Keith Thompson (The_Other_Keith) ks***@mib.org

<http://www.ghoti.net/~kst> San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst> We must do something. This is something. Therefore, we must do this.

Nov 15 '05 #78

Christian Bau wrote:
In article <43***********************@news.xs4all.nl>,
Skarmander <in*****@dontmailme.com> wrote:
toby wrote:
Christian Bau wrote:

>...
>Well, if anyone writes code like
>
>
>>> char* p = /* whatever */
>>> do
>>> {
>>> /* somestuff */
>>>
>>> } while (--p);
>
>then they will get what they deserve!
Do you really think

for( p = /*whatever*/ ; p ; --p ){
/*somestuff*/
}

is any better?

Of course, the idea of counting a *pointer* down to NULL is rather
implausible in real code. Maybe you intended an integer variable.

Hold on there. Is there any guarantee that any amount of -- applications
eventually yield a null pointer? Could this loop forever or does it
summon nasal demons?


Well, "toby" snipped too much of the previous post. What I wrote makes
only sense when you can read the bits that he removed as well.

(Hint: The last line of a joke is usually not very funny if the
beginning is missing).


Apologies, you're right: I didn't realise that the error was
intentional. Too subtle for me at that moment...

--T

Nov 15 '05 #79
Tom
Joe Butler wrote:
Let's put this into perspective.

Althought I don't know how to verify this, I suspect many 100s, perhaps
1000s, of people read these posts.

Only 2 or 3 people told me not to top post. That's 3 out of 1000? 3 out of
10,000? Who knows. That suggests to me that the vast majority of people
don't give a damn. Probably, like me, the vast majority are easily able to
deal with all the forms of posting and it is, therefore, not an issue for
them.


Don't know about majority, personally when I see a post that hard to
make sense of I'll just skip it and jump to next one...

Tom
Nov 15 '05 #80
On Wed, 28 Sep 2005 22:19:39 GMT, in comp.lang.c , Keith Thompson
<ks***@mib.org> wrote:
Mark McIntyre <ma**********@spamcop.net> writes:
[...]
I slightly agree with your conclusions tho. I'd modify (1) and (2) as
follows

1) Top Post (and totally remove the old message) if you are only
making 1 brief point which has no relation to any of the old message.
And then ask yourself why the hell you're replying to this post with
an irrelevant remark.


Top-posting is posting new text *above* any quoted text; if there is
no quoted text, it's not top-posting (or at best it's a degenerate
case that could as easily be called bottom-posting or middle-posting).
What you're describing is, or should be, simply posting a new article.


My point exactly.

--
Mark McIntyre
CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
CLC readme: <http://www.ungerhu.com/jxh/clc.welcome.txt>

----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
Nov 15 '05 #81
Bob
"Tom" <to*@nospam.net> wrote in message
news:90******************@nasal.pacific.net.au...
Joe Butler wrote:
Let's put this into perspective.

Althought I don't know how to verify this, I suspect many 100s, perhaps
1000s, of people read these posts.

Only 2 or 3 people told me not to top post. That's 3 out of 1000? 3 out of 10,000? Who knows. That suggests to me that the vast majority of people don't give a damn. Probably, like me, the vast majority are easily able to deal with all the forms of posting and it is, therefore, not an issue for them.


Don't know about majority, personally when I see a post that hard to
make sense of I'll just skip it and jump to next one...

Tom


Agreed. Life is too short to waste time un-mangling the conversation.

I have already kill-filed Joe Butler. (yes, I know that's is a rude thing to
say - it's part of my point, here) I have no idea how many more of the 100s
or 1000s who read c.a.e and c.l.c have also done so.

Oddly, the first post I see in this thread from him he has snipped and
bottom posted (unfortunately, without proper attribution for what he was
responding to). It is only his later posts that flaunt the etiquette of
these groups.

Bob
Nov 15 '05 #82
Joe Butler wrote:
Let's put this into perspective.

Althought I don't know how to verify this, I suspect many 100s, perhaps
1000s, of people read these posts.

Only 2 or 3 people told me not to top post. That's 3 out of 1000? 3 out of


Make that 4. I suspect that many others controlling themselves
and just waiting for this recurring flamefest to die.

Who knows why you cannot simply comply with the customs
of these groups. They are among the best usenet has to
offer.

<sigh>

--
Michael N. Moran (h) 770 516 7918
5009 Old Field Ct. (c) 678 521 5460
Kennesaw, GA, USA 30144 http://mnmoran.org

"So often times it happens, that we live our lives in chains
and we never even know we have the key."
The Eagles, "Already Gone"

The Beatles were wrong: 1 & 1 & 1 is 1

Nov 15 '05 #83

Robert Scott wrote:
It amazes me how some people can claim to speak for the whole group
with no documentation at all. I, for one, appreciate top-posting when
it is appropriate.


Indeed. Having just read the thread it has only just dawned on me
(after 18 years reading USENET) what "top posting" is. I always
thought it was posting a reply to the first message in a thread instead
of replying to the specific one you were answering - something that
would throw anyone off the trail... especially with threadded
newsreaders.

But now it appears it's something so small - the order of text within a
message. My God... how anal some people are. Ok, that's unfair, but
only just.

I can see how a top-posting may be harder to speed-read than a
bottom-posting but kill files? Abuse? Posting nagging comments to the
thread without actually furthering the discussion?

You know, people are clever. They can figure out messages. I don't
see how your personal quests do anything but make you feel important.
I don't know. This thread amazes me. It simply amazes me.

Nov 15 '05 #84
"Paul Marciano" <pm***@yahoo.com> writes:
Robert Scott wrote:
It amazes me how some people can claim to speak for the whole group
with no documentation at all. I, for one, appreciate top-posting when
it is appropriate.
[...] I can see how a top-posting may be harder to speed-read than a
bottom-posting but kill files? Abuse? Posting nagging comments to the
thread without actually furthering the discussion?


Take a look at the context in groups.google.com. One poster (initials
JB) was asked not to top-post. He made a top-posted followup. He was
reminded again. He replied with personal abuse, and has continued to
do so.

Most of us don't killfile posters for top-posting. People are
killfiled for being rude and abusive, especially when they do so in
response to good advice.

If you joined this thread already in progress, I can see how you might
think we're heaping abuse on top-posters. That's not what's going on.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Nov 15 '05 #85
Joe Butler wrote:
Let's put this into perspective.

Althought I don't know how to verify this, I suspect many 100s, perhaps
1000s, of people read these posts.

Only 2 or 3 people told me not to top post. That's 3 out of 1000? 3 out of
10,000? Who knows. That suggests to me that the vast majority of people
don't give a damn. Probably, like me, the vast majority are easily able to
deal with all the forms of posting and it is, therefore, not an issue for
them.

I understand that top-posting annoys some people. For me, when someone
who's only contribution is to butt in with something along the lines of
"space corp. directive one ex delta nine has been violated", that is
infinitely more annoying than any other person's posting style.

These groups have a high proportion of lurkers who seldom or never post,
a fair number who post semi-regularly, and a core who have been here for
years and contribute regularly for the benefit of all. It's often these
core posters that ask for usenet rules of courtesy to be followed - they
put a lot of time and effort into helping people here, and all they ask
in return is a little politeness. Personally, I can't see any reason
not to follow conventions - you say you understand that top-posting
annoys people, yet you continue to do it.
The only input 'Default User' (prick) gave at that point was, "You need to
get the other point, the one about not top-posting". If Default User had
any sense, he would have realised that I had chosen to ignore the advice
about top-posting, that it was not the first time that I had been told and,
therefore, it was a pretty pointless exercise to step in at that point.

Sincere regards to everyone.


Since you seem to have lost track of the history here, I'll summarise
it. A poster ("Flash Gordon") replied to your post with useful
information, along with a request that you follow usenet conventions to
make the thread easier for everyone. It's only when you completely
ignored that request that you got a curt reply - and you responded with
a personal insult. That's what got this thread rolling.

If you are on the phone to someone, and they ask you to speak a bit
louder, would you ignore the request? If they asked you a second time,
would you call them a "prick" ? If you are visiting someone's house, do
you put your feet on the table just because you do it at home? Or do
you light up a cigarette without asking, because that's your "personal
style" ? No, any time you interact with other people, you are polite
and respectful, and follow the conventions already established. Usenet
is nothing special in this regard.
Nov 15 '05 #86
Paul Marciano wrote:

<snip>
Indeed. Having just read the thread it has only just dawned on me
(after 18 years reading USENET) what "top posting" is. I always
thought it was posting a reply to the first message in a thread instead
of replying to the specific one you were answering - something that
would throw anyone off the trail... especially with threadded
newsreaders.
Yet you bottom post anyway. Probably because you have just followed the
convention because that is the normal and polite thing to do.
But now it appears it's something so small - the order of text within a
message. My God... how anal some people are. Ok, that's unfair, but
only just.
Since the posts won't get read by a number of skilled people otherwise
it is useful advise, as well as the long standing practice.
I can see how a top-posting may be harder to speed-read than a
bottom-posting but kill files? Abuse? Posting nagging comments to the
thread without actually furthering the discussion?
No, my initial reply contained one or two lines about posting style and
many lines of reply to the actual message. I was possibly a little short
in that one line but it was not kill filing or abuse and nor was it a
post not forwarding the discussion. I believe the same applies to most
if not all posts I have made where I have requested that people not top
post.
You know, people are clever. They can figure out messages. I don't
see how your personal quests do anything but make you feel important.
No, we do it because we are not prepared to put in the effort to deal
with the mess top-posting makes of a thread and would prefer that people
follow long standing conventions than that they were ignored and
received no assistance.
I don't know. This thread amazes me. It simply amazes me.


It amazes me that people who defend top posters assume that those
requesting newcomers follow the long standing convention of bottom
posting assume that all we ever do is complain about peoples posting
style and abuse them for it without bothering to check.
--
Flash Gordon
Living in interesting times.
Although my email address says spam, it is real and I read it.
Nov 15 '05 #87
On 30 Sep 2005 10:02:31 +0200, David Brown
<da***@westcontrol.removethisbit.com> wrote:
..These groups have a high proportion of lurkers who seldom or never post,
a fair number who post semi-regularly, and a core who have been here for
years and contribute regularly for the benefit of all. It's often these
core posters that ask for usenet rules of courtesy to be followed - they
put a lot of time and effort into helping people here, and all they ask
in return is a little politeness. Personally, I can't see any reason
not to follow conventions...
Conventions are standards that are agreed to by all or most of the
participants. The prohibition against top-posting is not one of them,
except in the mind of a few zelots. You are free to express your
opinion that you think top-posting is impolite, but when you try to
assign any authority to that opinion, don't be surprised if someone
like me calls you on it.
...If you are on the phone to someone, and they ask you to speak a bit
louder, would you ignore the request? If they asked you a second time,
would you call them a "prick" ? If you are visiting someone's house, do
you put your feet on the table just because you do it at home? Or do
you light up a cigarette without asking, because that's your "personal
style" ?


All these analogies are of one-on-one interactions. Usenet involves
many-to-one interactions. One person's request for what he thinks is
politeness has to be weighed with what others in the group think.
Just because one person is pissed whenever he sees top-posting that
does not mean everyone in the group, or even a majority of the group,
is similarly pissed. I just don't care. But I do care when people
who are self-appointed Internet cops try to make people feel like they
have done something wrong when in fact their crime was minimal or
non-existent.
-Robert Scott
Ypsilanti, Michigan
Nov 15 '05 #88
"Joe Butler" <ff***********@hotmail-spammers-paradise.com> writes:
Let's put this into perspective.

Althought I don't know how to verify this, I suspect many 100s, perhaps
1000s, of people read these posts.

Only 2 or 3 people told me not to top post. That's 3 out of 1000? 3 out of
10,000? Who knows. That suggests to me that the vast majority of people
don't give a damn. Probably, like me, the vast majority are easily able to
deal with all the forms of posting and it is, therefore, not an issue for
them.


The vast majority of long-term Usenet readers have lost whatever faith
in the educability of the human race that they might ever have had.

So when another person starts top-posting and insisting that they have
some divine right to ignore long-standing protocols that have developed
to ease communication in these groups, we just make use of the scoring
features on our news-reading programs.

Those who don't use news-readers with scoring appear to use killfiles
instead.

You'll never hear them complain because they can't hear you talk
anymore.

There *is* a reason long-standing cultures develop protocols for
communication, and it's not just to annoy others.

cheers, Rich.

--
rich walker | Shadow Robot Company | rw@shadow.org.uk
technical director 251 Liverpool Road |
need a Hand? London N1 1LX | +UK 20 7700 2487
www.shadow.org.uk/products/newhand.shtml
Nov 15 '05 #89
Robert Scott wrote:
On 30 Sep 2005 10:02:31 +0200, David Brown
<da***@westcontrol.removethisbit.com> wrote:

..These groups have a high proportion of lurkers who seldom or never post,
a fair number who post semi-regularly, and a core who have been here for
years and contribute regularly for the benefit of all. It's often these
core posters that ask for usenet rules of courtesy to be followed - they
put a lot of time and effort into helping people here, and all they ask
in return is a little politeness. Personally, I can't see any reason
not to follow conventions...

Conventions are standards that are agreed to by all or most of the
participants. The prohibition against top-posting is not one of them,
except in the mind of a few zelots. You are free to express your
opinion that you think top-posting is impolite, but when you try to
assign any authority to that opinion, don't be surprised if someone
like me calls you on it.


As I said before, I can't speak for the group, but as a long-term reader
I can say what I see as a rough summary of opinions expressed here (in
c.a.e., at least). Of course, I can't summarise un-expressed opinions
of people who don't care one way or the other.

And again, it's not so much the top-posting itself that is impolite.
There are other groups where top-posting is considered the norm, and
receives no objections - just as there are probably groups where html
posting or SMS language is considered normal. It's the arrogant
disrespect for common conventions, and the "I don't care what others
think, I'll make my own rules" attitude that is impolite.

...If you are on the phone to someone, and they ask you to speak a bit
louder, would you ignore the request? If they asked you a second time,
would you call them a "prick" ? If you are visiting someone's house, do
you put your feet on the table just because you do it at home? Or do
you light up a cigarette without asking, because that's your "personal
style" ?

All these analogies are of one-on-one interactions. Usenet involves
many-to-one interactions. One person's request for what he thinks is
politeness has to be weighed with what others in the group think.


The personal insult was a personal post to a single person, making the
analogies valid (IMHO, of course). But if you prefer, replace the phone
call or the house visit with a town-hall public meeting. We are still
talking about conversations between real people who dislike being
name-called.
Just because one person is pissed whenever he sees top-posting that
does not mean everyone in the group, or even a majority of the group,
is similarly pissed. I just don't care. But I do care when people
No one claims that everyone in the group, or the majority in the group,
get annoyed by top-posting. But (based on this thread, and countless
others before it), the majority of those *who express an opinion*
dislike top-posting.
who are self-appointed Internet cops try to make people feel like they
have done something wrong when in fact their crime was minimal or
non-existent.


Remember, the "crime" in question was not top-posting - it was
deliberate, repeated top-posting after receiving a polite request to
stop it, followed by a personal insult, although it's still minor in the
grand scheme of things.
Nov 15 '05 #90

Paul Marciano wrote:
Robert Scott wrote:
It amazes me how some people can claim to speak for the whole group
with no documentation at all. I, for one, appreciate top-posting when
it is appropriate.

(snip)
But now it appears it's something so small - the order of text within a
message. My God... how anal some people are. Ok, that's unfair, but
only just.
(snip)
You know, people are clever. They can figure out messages. I don't
see how your personal quests do anything but make you feel important.
I don't know. This thread amazes me. It simply amazes me.


Gulliver would perhaps have called that the battle of
top postians vs bottom postians ;)

Nov 15 '05 #91
On Fri, 30 Sep 2005 11:45:15 GMT, no****@dont-mail-me.com (Robert
Scott) wrote:
On 30 Sep 2005 10:02:31 +0200, David Brown
<da***@westcontrol.removethisbit.com> wrote:
..These groups have a high proportion of lurkers who seldom or never post,
a fair number who post semi-regularly, and a core who have been here for
years and contribute regularly for the benefit of all. It's often these
core posters that ask for usenet rules of courtesy to be followed - they
put a lot of time and effort into helping people here, and all they ask
in return is a little politeness. Personally, I can't see any reason
not to follow conventions...


Conventions are standards that are agreed to by all or most of the
participants. The prohibition against top-posting is not one of them,
except in the mind of a few zelots. You are free to express your
opinion that you think top-posting is impolite, but when you try to
assign any authority to that opinion, don't be surprised if someone
like me calls you on it.


FWIW (very little, I suspect, I'm not sure why I'm bothering)...

I for one don't find top-posting "rude" per se, but I do find failure
to trim quoting "rude." IME, top-posters are the most egregious
offenders -- if they can't be bothered to put their comments in
context, they surely can't be bothered to trim irrelevent quotes.

I do find top-posts harder to read, and am more likely to skim and
skip them. That's really the choice every poster has to make. If the
post is hard to read, fewer people will put the effort into reading
it. If you don't want people to actually read your post, top-posting
is a good way to discourage them.

I am most reluctant to respond to top-posts, because the flow of the
conversation is all messed up, and it's usually not worth the effort
to reformat. So if you want the last word, perhaps its better to top
post.

Finally, I don't plonk posters, I plonk threads. I was hoping for a
little more useful content out of this one, but it's probably in vain.
I've held on longer than I normally do, and I won't be here much
longer.

Regards,

-=Dave
--
Change is inevitable, progress is not.
Nov 15 '05 #92
Robert Scott wrote:
On 30 Sep 2005 10:02:31 +0200, David Brown
<da***@westcontrol.removethisbit.com> wrote:
..These groups have a high proportion of lurkers who seldom or never post,
a fair number who post semi-regularly, and a core who have been here for
years and contribute regularly for the benefit of all. It's often these
core posters that ask for usenet rules of courtesy to be followed - they
put a lot of time and effort into helping people here, and all they ask
in return is a little politeness. Personally, I can't see any reason
not to follow conventions...

Conventions are standards that are agreed to by all or most of the
participants. The prohibition against top-posting is not one of them,
except in the mind of a few zelots.


Most posts are *not* top posted, and this includes yours, therefore it
has been implicitly agreed upon by the majority of participants.

Had you checked the history of comp.lang.c you would find that this has
been the case for a long time, and also that the people who advocate
top-posting are *not* in general long time participants and that almost
every post by a long time participant in comp.lang.c on the subject has
been against top-posting and in favour of bottom and middle posting.
You are free to express your
opinion that you think top-posting is impolite, but when you try to
assign any authority to that opinion, don't be surprised if someone
like me calls you on it.
Feel free, but it is still true that the majority of the regulars on
comp.lang.c have only posted messages against top-posting and for
bottom/middle posting.
...If you are on the phone to someone, and they ask you to speak a bit
louder, would you ignore the request? If they asked you a second time,
would you call them a "prick" ? If you are visiting someone's house, do
you put your feet on the table just because you do it at home? Or do
you light up a cigarette without asking, because that's your "personal
style" ?


All these analogies are of one-on-one interactions. Usenet involves
many-to-one interactions. One person's request for what he thinks is
politeness has to be weighed with what others in the group think.


And the majority of the regulars in comp.lang.c consider top posting to
be impolite.
Just because one person is pissed whenever he sees top-posting that
does not mean everyone in the group, or even a majority of the group,
is similarly pissed. I just don't care. But I do care when people
who are self-appointed Internet cops try to make people feel like they
have done something wrong when in fact their crime was minimal or
non-existent.


Most of the regulars do not respond because they agree with the posts
regulars (do I count as a regular yet?) or semi-regulars make against
top posting.

So far I have not seen any of those more knowledgeable than me from
comp.lang.c post in favour of top posting, and the posts from those
comp.lang.c regulars that have participated in this sub-thread have all
been against it.
--
Flash Gordon
Living in interesting times.
Although my email address says spam, it is real and I read it.
Nov 15 '05 #93
In article <43***********************@news.zen.co.uk>,
Joe Butler <ff***********@hotmail-spammers-paradise.com> wrote:
Althought I don't know how to verify this, I suspect many 100s, perhaps
1000s, of people read these posts. Only 2 or 3 people told me not to top post. That's 3 out of 1000? 3 out of
10,000? Who knows. That suggests to me that the vast majority of people
don't give a damn.
I, for one, didn't see a need to post a "Me too!" signifying agreement
with the people who asked you not to top-post, as my -assumption- was
that you were a reasonable person who would be able to learn upon
hearing an idea once instead of having to have it repeated multiple
times. Was that a misjudgement on my part??

Probably, like me, the vast majority are easily able to
deal with all the forms of posting and it is, therefore, not an issue for
them.


"the vast majority" don't read literally hundreds of technical
messages every day and try to keep them mentally straight so they
can give the right advice to the right person. "the vast majority"
don't spend hours every day doing free technical research and
consulting for other people.
--
University of Calgary researcher Christopher Auld has found that
milk is the most "rational addiction" amongst the several studied.
Nov 15 '05 #94

Lanarcam wrote:
Gulliver would perhaps have called that the battle of
top postians vs bottom postians ;)


True.

Forgive me for further reducing the signal to noise ratio in this
thread, but I did want to add a few more things.

I don't bottom post due to conforming with policy, I do so because...
well... it's good style. Question... answer. Quote... response.

I'm not defending top posters. I don't know them - they may all be
assholes for all I know.

I'm certainly not attacking individuals. I took a quick look at
previous posts by the anti-top-posters here and you're all very cool,
knowledgable people. If anything I'm attacking the message, not the
messenger.
What I see is a technical thread deteriorate into a style war, for top
posting vs. bottom posting is mearly a matter of style and, like those
who wear super baggy grunge jeans, some people just don't have it.

I agree that top posting is bad style, but make the point and move on.
It's helpful to point out the style faux pas, but to keep on and on and
on...
IT'S LIKE GETTING UPSET BECAUSE PEOPLE TYPE MESSAGES IN CAPITALS.
Don't do that - it's shouting. Well.. it's not actually shouting is
it? It's just poor style, like misusing, punctuation.
I bottom post. I prefer vim to emacs. I use both Windows and Linux.
I use both Linux and BSD. I respect the GPL but prefer the BSD
license. I agree with copyrights but disagree with software patents.
I like my coffee white and my cola black. People who can only program
in BASIC are ok.

People are different. If you can't accept the differences at least try
to tolerate them. If you can't bring yourself to tolerate them...
because... well... just God dammit why can't you just get a clue and
bottom post like everyone else... well... please be gentle whilst
trying to educate the unwashed.
(if you're still reading this... wow... you need to find a hobby).
Regards,
Paul.

Nov 15 '05 #95
Robert Scott wrote:

Conventions are standards that are agreed to by all or most of the
participants. The prohibition against top-posting is not one of them,
except in the mind of a few zelots. You are free to express your
opinion that you think top-posting is impolite, but when you try to
assign any authority to that opinion, don't be surprised if someone
like me calls you on it.


And how many regulars from comp.lang.c have come out in favor of
top-posting? Exactly none. This has been hashed out so many times that
most feel no need to chime in.

We (c.l.c) don't presume to speak for comp.arch.embedded, of course.

Brian
Nov 15 '05 #96
David Brown wrote:

And again, it's not so much the top-posting itself that is impolite.
There are other groups where top-posting is considered the norm, and
receives no objections - just as there are probably groups where html
posting or SMS language is considered normal. It's the arrogant
disrespect for common conventions, and the "I don't care what others
think, I'll make my own rules" attitude that is impolite.

Right. If a person is a jerk about something like this, he's likely
going to a jerk down the line about other stuff. HE is the one who
wants help, yet can't bring himself to behave in a vaguely polite
manner.

Why should any of us bother with him? I for one won't, as mentioned he
immediately went into the killfile.


Brian

Nov 15 '05 #97
"Paul Marciano" <pm***@yahoo.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...

People are different. If you can't accept the differences at least try
to tolerate them. If you can't bring yourself to tolerate them...
because... well... just God dammit why can't you just get a clue and
bottom post like everyone else... well... please be gentle whilst
trying to educate the unwashed.
Well said - my feelings entirely.
(if you're still reading this... wow... you need to find a hobby).


Ah. Erm. Hmmm. Ooops. Touché.

Steve
http://www.fivetrees.com
Nov 15 '05 #98
In article <dh**********@canopus.cc.umanitoba.ca> ro******@ibd.nrc-cnrc.gc.ca (Walter Roberson) writes:
In article <43***********************@news.zen.co.uk>,
Joe Butler <ff***********@hotmail-spammers-paradise.com> wrote:

....
Only 2 or 3 people told me not to top post. That's 3 out of 1000? 3 out of
10,000? Who knows. That suggests to me that the vast majority of people
don't give a damn.


I, for one, didn't see a need to post a "Me too!" signifying agreement
with the people who asked you not to top-post, as my -assumption- was
that you were a reasonable person who would be able to learn upon
hearing an idea once instead of having to have it repeated multiple
times. Was that a misjudgement on my part??


In general I ignore all articles that are toppostings and all articles
that do not quote anything from the article responded to.
--
dik t. winter, cwi, kruislaan 413, 1098 sj amsterdam, nederland, +31205924131
home: bovenover 215, 1025 jn amsterdam, nederland; http://www.cwi.nl/~dik/
Nov 15 '05 #99
If your counting bytes, all I can say is that you better make sure your
project does suffer from 'requirements creep'! While it *may* be an
interesting exercise to find the most efficient compiler, coding style
in the form of the for loop in this thread, will also impact the
efficiencies. I would bet there are plenty of other areas to save space
(i.e., how many useless libraries are being linked in?-a compiler issue,
or, what architectural changes should be made to your design such as
getting rid of large amounts of shared variables-do they really need to
be shared?). OTOH, if you are in the $10 retail produce area then
saving $0.20 over the next processor in the line may be worth all the
extra engineering time. Somehow, after living thought many sides of
this problem, throwing hardware at it is usually the best approach. Just
a personal opinion from experience, your mileage and situation may vary.....
John
Joe Butler wrote:
OK, point taken. Although, when working with very small memories, it can
make all the difference if a byte can be saved here and there. Afterall, 50
such 'optimisations' could amount to 10% of the total memory available. I'm
not necessarily suggesting this should be done from day 1, but have found it
useful just to get a feel for what the compiler works best with.

"Flash Gordon" <sp**@flash-gordon.me.uk> wrote in message
news:sm************@brenda.flash-gordon.me.uk...
Joe Butler wrote:

Don't top post. Replies belong after the text you are replying to.

"Flash Gordon" <sp**@flash-gordon.me.uk> wrote in message
news:rq************@brenda.flash-gordon.me.uk...
Joe Butler wrote:
>>That is not an optimization, but a total waste of time. Read the first
>>example in "Elements of programming style" and learn...
>
>What if the difference is between fitting into memory and not?

If you are hunting for that small an amount to get the program to fit
then you are in trouble anyway. Something will need changing making it
no longer fit!
--
Flash Gordon
Living in interesting times.
Although my email address says spam, it is real and I read it.


Don't include peoples signatures unless you are commenting on them.
> I think I disagree.
>
> If you can fit something into a cheaper processor model because you
> save a couple of bytes by changing 1 or two loops, then you are not in
> trouble anymore.


I'll be more explicit then. EVERY SINGLE TIME I have come across a
system where people have tried to squeeze the code in believing it will
just about fit (either size or speed) one of the following has happened:

1) Customer required a subsequent change which proved to be impossible
unless the card was redesigned because there was no space for the new
code.
2) A bug fix requires some additional code and oops, there is no more
space.
3) By the time all the required stuff was added that the person who
thought it would only just fit had forgotten it did NOT fit by a mile
so it did not even come close to meeting the customers requirements
4) It turned out there were massive savings to be had else where because
of higher level problems allowing me to save far more space/time than
you could possibly save by such micro-optimisations.

Only with the third of those possibilities was it possible to meet the
requirements using the existing hardware, and meeting the requirements
involved fixing the algorithms or doing large scale changes where the
coding was just plain atrocious.

So my experience is that it is never worth bothering with such
micro-optimisations.
--
Flash Gordon
Living in interesting times.
Although my email address says spam, it is real and I read it.


Nov 15 '05 #100

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

Similar topics

12
by: Kamilche | last post by:
I was looking for a way to speed up detecting invalid characters in my TCP string, and thought of yet another use for the translate function! If you were to 'translate out' the bad characters, and...
1
by: Rudy Koento | last post by:
Hi, I've created an index but it's not being used by postgresql when doing a query. But doing an "explain analyze" shows that with index, it's faster. Here's the output: ...
34
by: sushant | last post by:
hi all, suppose i have 2 loops one inside the other, like this 1) for(i=0;i<=100;i++) { for(j=0;j<=10;j++) { some code; }
11
by: bill | last post by:
I am trying to figure out if I can use sse to help execute arithmetic operations faster. I have 900 values that must each be scaled with a divide and multiply. This happens repeatedly. Any examples...
2
by: Jeffrey Melloy | last post by:
I have been using tsearch2 for quite a while with a fair amount of success. The other day I was playiing around with a query, and randomly changed a few things. I noticed a 10 times speedup and...
11
by: Farel | last post by:
Which is Faster in Python and Why? jc = {}; m = x = ,,.......] # upwards of 10000 entries def mcountb(): for item in x: b = item; b.sort(); bc = 0 for bitem in b: bc += int(bitem) try: m...
5
by: sololoquist | last post by:
#define COUNT_UP #include <stdio.h> #define N 10 int main() { int i; #ifdef COUNT_UP for (i = 0; i < N; i++)
23
by: AndersWang | last post by:
Hi, dose anybody here explain to me why memset would be faster than a simple loop. I doubt about it! In an int array scenario: int array; for(int i=0;i<10;i++) //ten loops
17
by: onkar | last post by:
which one runs faster ?? for(i=0;i<100;i++) for(j=0;j<10;j++) a=0; OR for(j=0;j<10;j++) for(i=0;i<100;i++)
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.