Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

averages

2 views
Skip to first unread message

Bill Cunningham

unread,
Jun 27, 2009, 3:42:10 PM6/27/09
to
I want to write a function that takes several doubles to average with an
int. An arithmetic mean, exponential mean and geometric mean to get started.
These are my prototypes.

double Sma (double *,int); /*arithmetic mean */
double Ema (double *, int); /* exponential mean */

Bill


Malcolm McLean

unread,
Jun 27, 2009, 3:57:02 PM6/27/09
to

"Bill Cunningham" <nos...@nspam.invalid> wrote in message news
For Sma(), use a for loop to sum the array, then divide by the int to
calculate the mean.


Lew Pitcher

unread,
Jun 27, 2009, 3:58:10 PM6/27/09
to
On June 27, 2009 15:42, in comp.lang.c, Bill Cunningham
(nos...@nspam.invalid) wrote:

> I want to write a function that takes several doubles to average with an
> int.

What do you mean "to average with an int"?

> An arithmetic mean, exponential mean and geometric mean to get
> started. These are my prototypes.
>
> double Sma (double *,int); /*arithmetic mean */
> double Ema (double *, int); /* exponential mean */

Nice prototypes.

I'm not certain of the reason you posted this note. Is it to tell us
something about yourself ("I want to write") or is it to ask us a question
(i.e. "How do I write ...?")? You might want to clarify this before
proceeding.

--
Lew Pitcher

Master Codewright & JOAT-in-training | Registered Linux User #112576
http://pitcher.digitalfreehold.ca/ | GPG public key available by request
---------- Slackware - Because I know what I'm doing. ------


Bill Cunningham

unread,
Jun 27, 2009, 6:33:42 PM6/27/09
to

"Lew Pitcher" <lpit...@teksavvy.com> wrote in message
news:7edb9$4a4679d3$4c0a94f5$30...@TEKSAVVY.COM-Free...

> Nice prototypes.
>
> I'm not certain of the reason you posted this note. Is it to tell us
> something about yourself ("I want to write") or is it to ask us a question
> (i.e. "How do I write ...?")? You might want to clarify this before
> proceeding.

Ok Lew I use the double * for this -

12.96+13.21+14

The int is to divide the sum of the above numbers by. In this case the int
would be 3. I suppose I wouldn't have to do it like this, the function could
count for me and determine its own int value.

My real concern is the first parameter. Is the double * the right way to
go? To pass several doubles to the function ?

double Sma (double *numbers)
{
...}

Now I need to keep track somehow to the number of number entered here. In
the above case that would be numbers[0], numbers[1], and numbers[3]. How
would I set up a counting mechanism in C to count 3, 15,20 ,150 or however
many numbers[n] there is?

Does this help?

Bill


Tim Harig

unread,
Jun 27, 2009, 6:45:39 PM6/27/09
to
On 2009-06-27, Bill Cunningham <nos...@nspam.invalid> wrote:
> Now I need to keep track somehow to the number of number entered here. In
> the above case that would be numbers[0], numbers[1], and numbers[3]. How
> would I set up a counting mechanism in C to count 3, 15,20 ,150 or however
> many numbers[n] there is?

The question is not how to keep track of the quantity of numbers entered
but how you are managing your memory as the numbers are input. Memory
management is a large topic with many different solutions that are
optimized for many different problems. A simple singly-linked list should
work well for what you are trying to do:

http://en.wikipedia.org/wiki/Linked_list

Lew Pitcher

unread,
Jun 27, 2009, 6:50:16 PM6/27/09
to
On June 27, 2009 18:33, in comp.lang.c, Bill Cunningham
(nos...@nspam.invalid) wrote:

Yes, thank you.

OK, so you use the integer argument to denote the number of doubles being
passed through the double * argument. That's cool.

You ask if
double *
is the right way to pass several doubles to the function.

Yes, you can use either
double *list
or
double list[]
this way. As /function argument list specifiers/, they both mean the same
thing. The function will receive a pointer-to-double which it can then use
as a pointer to the first element of an array of doubles.

Within the body of the function, you can access elements of this array
either through pointer arithmetic
*(list + element_number)
or through array subscripting
list[element_number]


BTW, my original question was prompted because I misread your prototypes.
Sorry for that.

Gordon Burditt

unread,
Jun 27, 2009, 7:15:10 PM6/27/09
to
> Ok Lew I use the double * for this -
>
>12.96+13.21+14
>
>The int is to divide the sum of the above numbers by. In this case the int
>would be 3. I suppose I wouldn't have to do it like this, the function could
>count for me and determine its own int value.

*HOW* will the function count for you and determine its own int
value? If you pass an integer count of the number of doubles to
average, that's fine, it will work great. Beware, though, that you
can't check whether the integer passed is a lie or not. If you
don't pass in a count, how are you going to figure out when you've
hit the end?

You could use a special value to indicate "that's all the data",
like 0, a negative number, NaN, +Infinity, -Infinity, Pi, or whatever.
But think hard - if that number can also be a legitimate data item,
you've got a problem. You can't use this method in something that's
supposed to be a "general purpose averaging function".

> My real concern is the first parameter. Is the double * the right way to
>go? To pass several doubles to the function ?
>
>double Sma (double *numbers)
>{
> ...}
>
>Now I need to keep track somehow to the number of number entered here. In

The main ways are: you pass a count, or you pass a special value
marking "end of data" after the last valid value. Other icky ways
include passing a count via a global variable.

>the above case that would be numbers[0], numbers[1], and numbers[3]. How
>would I set up a counting mechanism in C to count 3, 15,20 ,150 or however
>many numbers[n] there is?

I'm sure you know how to set an index variable to 0, then increment it.
You can test the doubles for being a special value, say -1776.0,
and if you hit that value, you've reached the end of the data (don't
average in the -1776.0). The caller has to remember to stick the
-1776.0 at the end of the list.

C will not necessarily give you an indication when you've read data
you weren't passed. Some systems will give a smegmentation violation
which might indicate you've gone a few thousand or a few million
numbers too far.

Note that if you decide to not use a double *, but to use a varargs
function taking a variable number of doubles, you've got exactly
the same problem about when to stop.

Barry Schwarz

unread,
Jun 27, 2009, 7:36:06 PM6/27/09
to

Here is the same advice Nick sent regarding your previous project:

"do you know hoe to solve this problem with pencil and paper and a
calculator?

If you don't you won't be able to program it."

Since the phrase "exponential mean" has no meaning except for
exponential distributions, odds are your prototype for Ema is not what
you want.

I wonder why you did not provide a prototype for geometric mean.

I wonder why you called the arithmetic mean function Sma and not Ama.

I wonder why you posted this at all since you didn't ask a question or
post code for review.

--
Remove del for email

Bill Cunningham

unread,
Jun 27, 2009, 7:38:37 PM6/27/09
to

"Gordon Burditt" <gordon...@burditt.org> wrote in message
news:YLydnQAIN8BjOtvX...@posted.internetamerica...

> *HOW* will the function count for you and determine its own int
> value? If you pass an integer count of the number of doubles to
> average, that's fine, it will work great. Beware, though, that you
> can't check whether the integer passed is a lie or not. If you
> don't pass in a count, how are you going to figure out when you've
> hit the end?

[snip]

The m in Sma() and Ema() means "moving" as in a moving average. So if my
second parameter int count for example is 12, and 15 numbers are in the list
the 3 oldest are to be eliminated or atleast put somewhere in a file or
something for safekeeping and dropped from the average. That's how I would
know that I've hit the "end". As a 13th number is added to the beginning,
the 1st or oldest value is removed from the average. Just something more I
guess to complicate my life.

Bill


Tim Harig

unread,
Jun 27, 2009, 7:43:19 PM6/27/09
to
On 2009-06-27, Bill Cunningham <nos...@nspam.invalid> wrote:
> Now I need to keep track somehow to the number of number entered here. In
> the above case that would be numbers[0], numbers[1], and numbers[3]. How
> would I set up a counting mechanism in C to count 3, 15,20 ,150 or however
> many numbers[n] there is?

The question is not how to keep track of the quantity of numbers entered


but how you are managing your memory as the numbers are input. Memory
management is a large topic with many different solutions that are
optimized for many different problems.

Using an array, and reallocating if necessary, is okay for small sets; but,
for largers sets more common with general use requires something more.


A simple singly-linked list should work well for what you are trying to do:

http://en.wikipedia.org/wiki/Linked_list

Once you have your memory managed using the single list, all you have to do
is count the number of links in the chain. Since you already have to get a
sum of the data items, you can count the links while you add them:

#include <stdlib.h>
#include <stdio.h>

struct link {
struct link* next;
double number;
};

double Sma(struct link* data) {

/* count and total the numbers for each link in the chain */
struct link* current = data;
int count = 0;
double sum = 0;
while (current != NULL) {

/* calculate data */
count += 1;
sum += current->number;

/* move to the next link */
current = current->next;
}

/* check for zero before division -- calculate and return mean */
if (count == 0) return 0;
return (sum / count);
}

int main() {

float dataset[] = {3, 15, 20, 150};

/*
simulate input or generation -- this would normally be a while loop
because you don't know how many numbers you will have to index
*/
float current_number;
struct link* head = NULL;
struct link* current = NULL;
int index;
for(index = 0; index < 4; index++) {

/* create a new chain if necessary */
if (head == NULL) {
head = malloc(sizeof(struct link));
if (head == NULL) {
puts("Error: cannot allocate memory.\n");
return 1;
}

/* save the data */
head->next = NULL;
head->number = dataset[index];
current = head;
}

/* otherwise add a link */
else {
current->next = malloc(sizeof(struct link));
if (current->next == NULL) {
puts("Error: cannot allocate memory.\n");
return 1;
}

/* move to the new link and save the data */
current = current->next;
current->next = NULL;
current->number = dataset[index];
}
}

/* get your average */
printf("%f", Sma(head));

/* free the allocated memory before exiting */
while (head != NULL) {
current = head->next;
free(head);
head = current;
}
return 0;
}

Gordon Burditt

unread,
Jun 27, 2009, 8:01:43 PM6/27/09
to
>> *HOW* will the function count for you and determine its own int
>> value? If you pass an integer count of the number of doubles to
>> average, that's fine, it will work great. Beware, though, that you
>> can't check whether the integer passed is a lie or not. If you
>> don't pass in a count, how are you going to figure out when you've
>> hit the end?
>[snip]
>
>The m in Sma() and Ema() means "moving" as in a moving average. So if my
>second parameter int count for example is 12, and 15 numbers are in the list

So how does your function *KNOW* that 15 numbers are in the list?
If you're passing a "double *" to the function, it can't be a linked
list. Is the double after the last number that counts set to -1776.0
as a marker?

Bill Cunningham

unread,
Jun 27, 2009, 8:20:27 PM6/27/09
to

"Gordon Burditt" <gordon...@burditt.org> wrote in message
news:PKmdnUb09fN6L9vX...@posted.internetamerica...

> So how does your function *KNOW* that 15 numbers are in the list?

That's the big question. I don't know. This is in idea stage at this
time. I am writing prototypes in a header right now.

> If you're passing a "double *" to the function, it can't be a linked
> list. Is the double after the last number that counts set to -1776.0
> as a marker?

Any negative number would do. Even -1 that some functions return on
failure.

Bill


Keith Thompson

unread,
Jun 27, 2009, 8:59:14 PM6/27/09
to

If count is 12, how will your function know that there are 15 numbers
in the list?

--
Keith Thompson (The_Other_Keith) ks...@mib.org <http://www.ghoti.net/~kst>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"

Bill Reid

unread,
Jun 27, 2009, 9:05:24 PM6/27/09
to

"Barry Schwarz" <schw...@dqel.com> wrote in message
news:p75d45tvnbkb7dhs6...@4ax.com...

> On Sat, 27 Jun 2009 15:42:10 -0400, "Bill Cunningham"
> <nos...@nspam.invalid> wrote:
>
>> I want to write a function that takes several doubles to average with
>> an
>>int. An arithmetic mean, exponential mean and geometric mean to get
>>started.
>>These are my prototypes.
>>
>>double Sma (double *,int); /*arithmetic mean */
>>double Ema (double *, int); /* exponential mean */
>
> Here is the same advice Nick sent regarding your previous project:
>
> "do you know hoe to solve this problem with pencil and paper and a
> calculator?
>
> If you don't you won't be able to program it."
>
Who you calling a "hoe"?

> Since the phrase "exponential mean" has no meaning except for
> exponential distributions, odds are your prototype for Ema is not what
> you want.
>
> I wonder why you did not provide a prototype for geometric mean.
>
> I wonder why you called the arithmetic mean function Sma and not Ama.
>

I, in my borderline mystical way, know the answers to all these questions,
based on his previous posts, and my knowledge of the particular type of
software
he's TRYING to write (been TRYING to write for what? seven years now?)...and
I hardly even read this group...

> I wonder why you posted this at all since you didn't ask a question or
> post code for review.
>

I thought he wanted somebody like me who can read his mind to
fill in the code for his prototypes...

Anyway, I won't do that, but he should proceed from the reading
of the data from his "database" forward through malloc'ing an array of
doubles, the size of which is stored as that int he has in his prototype.
Then he can proceed to call his averaging functions, since he will
have MOST of what he needs to calculate the various averages...

What he REALLY wants to do, REALLY, is set up a structure that
includes the number of doubles in the array, and a pointer to the array
(as a bare minimum to solve the problem). He checks his database
to see how many of the double fields he CAN read into memory (then,
IDEALLY, compares this to how many he WANTS to read into
memory for any particular operation he may want to perform), THEN
he malloc's the array and writes the number of items to be read
into the array into the int member of the structure, AND THEN
he reads the "database" (such as it is) double fields into the array
(except, REALLY, he wants an array of "time series" structs that
include the date "key" field that corresponds to each double field),
THEN he is now ready to start performing all kinds of operations
on that time range of data...assuming he actually has enough data
to perform the desired operation in the first place; for example, it's
impossible to find the average of 200 doubles when in fact you
only have 150 double fields in the "database", so in THAT case, you
might want to spit the fact that it is impossible to perform the
operation back at the user or really the requesting module due
to "INSUFFICIENT DATA"...

Yeah, you're right, if you can do it with paper and pencil, it's easy
to do it in software...

---
William Ernest Reid

Tim Harig

unread,
Jun 27, 2009, 9:21:14 PM6/27/09
to
On 2009-06-28, Bill Cunningham <nos...@nspam.invalid> wrote:
>On 2009-06-27, Bill Cunningham <nos...@nspam.invalid> wrote:
>> The m in Sma() and Ema() means "moving" as in a moving average. So if my
>> second parameter int count for example is 12, and 15 numbers are in the list
>> the 3 oldest are to be eliminated or atleast put somewhere in a file or

You should have told us from the beginning that you only wanted a running
total. It makes a *HUGE* difference in your design. Again I would suggest
using data structures rather the arrays. For a running average, a
doubly-linked array data structure would be ideal.

I already posted a example of using a singly linked data structure to
find a simple average. It could easily be modified to calculate your
running average if you also modify it to used a doubly linked list.

> something for safekeeping and dropped from the average. That's how I would
> know that I've hit the "end". As a 13th number is added to the beginning,
> the 1st or oldest value is removed from the average. Just something more I
> guess to complicate my life.

If you want to use arrays Use a standard average function but trim the
input to include. Something like (psuedo code):

/*
from a array of total_count elements, return a pointer to last wanted_count
element from the end -- returns NULL if not enough elements are available
*/
double* tail(double* data, int total_count, int wanted_count);

/*
from a data array of count number of elements, retrn the average
*/
double average(double* data, int count);

/* same argument definition as tail() */
double Sma(double* data, int total_count, int wanted_count) {
new_set = tail(data, total_count, wanted_count)
if (new_set == NULL) {
global_error_flag = ERROR;
return whatever_invalid_unable_to_indentify_as_worthless;
}
return average(new_set, wanted_count);
}

Note that you will have to define some kind of error handling system as you
cannot indicate errors using doubles.

> news:PKmdnUb09fN6L9vX...@posted.internetamerica...
>> So how does your function *KNOW* that 15 numbers are in the list?
> That's the big question. I don't know. This is in idea stage at this
> time. I am writing prototypes in a header right now.

The bottom line is that you are leaping without a clue of what you are
doing right now. Stop, clarify what you are doing, listen to
what people are telling you, then think again. Only then should you act.

A. Assuming you are using an array or singly linked list -- not a doubly
linked list -- you have to tell it where to find the first point, how
may datapoints you are passing to it, where to find the first datapoint you
want tabulated, and how many elements you want tabulated. Then you *MUST*
give it exactly what you told it you would give it or you can cause an
overun.

If you pass it a doubly linked list, then it can find the data locations
and the limits of the dataset for itself. I have already posted a simple
average routine using a singly linked list before I realized you wanted a
running average. I could be modified easily enough to calculate a running
average if you modify it to use doubly linked lists for your data
structure.

>> If you're passing a "double *" to the function, it can't be a linked
>> list. Is the double after the last number that counts set to -1776.0
>> as a marker?

Where did the -1776.0 come from? I didn't see it in the thread?

> Any negative number would do. Even -1 that some functions return on
> failure.

I am not sure what this is in reponse to?

If you are thinking of passing -1 to a function as a pointer then you
are in error as pointers are unsigned and using a constant to a pointer
is insane. If you are thinking as passing it along as a double, then
how will you determine whether a -1 is valid data or an error?

Functions which pass -1 can do so only because they have elimited negative
numbers as valid data. Doing so is usually a sign of poor design even
when it is possible (see _Code Complete_ by Steve McConnell and _Writing
Solid Code_ by Steve Maguire).

Chris M. Thomasson

unread,
Jun 27, 2009, 9:46:05 PM6/27/09
to

"Bill Cunningham" <nos...@nspam.invalid> wrote in message
news:4a467620$0$23775$bbae...@news.suddenlink.net...
___________________________________________________________________
#include <stdio.h>


#define DEPTH(a) (sizeof(a) / sizeof(*a))


double
calc_and_output_avg(
double* const self,
size_t depth,
FILE* file
) {
if (depth) {
size_t i;
double total = 0;
fputc('{', file);
for (i = 0; i < depth; ++i) {
total += self[i];
if (i + 1 < depth) {
fprintf(file, "%f, ", self[i]);
} else {
fprintf(file, "%f} has an average of ", self[i]);
}
}
fprintf(file, "%f\n", total / depth);
return total / depth;
}
return 0;
}


int main(void) {
double x[] = { 1.6, 4.3, 6.1, 0.6 };
double y[] = { 4.5, 14.3 };
double z[] = { 3.5, 6.9, 2.6 };
calc_and_output_avg(x, DEPTH(x), stdout);
calc_and_output_avg(y, DEPTH(y), stdout);
calc_and_output_avg(z, DEPTH(z), stdout);
return 0;
}
___________________________________________________________________

Chris M. Thomasson

unread,
Jun 27, 2009, 9:51:59 PM6/27/09
to

"Chris M. Thomasson" <n...@spam.invalid> wrote in message
news:h26huq$1o86$1...@news.ett.com.ua...

>
> "Bill Cunningham" <nos...@nspam.invalid> wrote in message
> news:4a467620$0$23775$bbae...@news.suddenlink.net...
>> I want to write a function that takes several doubles to average with
>> an int. An arithmetic mean, exponential mean and geometric mean to get
>> started. These are my prototypes.
>>
>> double Sma (double *,int); /*arithmetic mean */
>> double Ema (double *, int); /* exponential mean */
[...]

or maybe something like:
___________________________________________________________________
#include <stdio.h>


#define DEPTH(a) (sizeof(a) / sizeof(*a))


double
calc_and_output_avg(
double* const self,
size_t depth,
FILE* file
) {
if (depth) {
size_t i;
double total = 0;

if (file) fputc('{', file);


for (i = 0; i < depth; ++i) {
total += self[i];

if (file) {


if (i + 1 < depth) {
fprintf(file, "%f, ", self[i]);
} else {
fprintf(file, "%f} has an average of ", self[i]);
}
}
}

if (file) fprintf(file, "%f\n", total / depth);


return total / depth;
}
return 0;
}


int main(void) {
double x[] = { 1.6, 4.3, 6.1, 0.6 };
double y[] = { 4.5, 14.3 };
double z[] = { 3.5, 6.9, 2.6 };
calc_and_output_avg(x, DEPTH(x), stdout);
calc_and_output_avg(y, DEPTH(y), stdout);
calc_and_output_avg(z, DEPTH(z), stdout);

printf("%f\n", calc_and_output_avg(x, DEPTH(x), NULL));
printf("%f\n", calc_and_output_avg(y, DEPTH(y), NULL));
printf("%f\n", calc_and_output_avg(z, DEPTH(z), NULL));
return 0;
}
___________________________________________________________________


;^)

Bill Cunningham

unread,
Jun 27, 2009, 10:00:18 PM6/27/09
to

"Tim Harig" <use...@ilthio.net> wrote in message
news:eAz1m.1498$cl4...@flpi150.ffdc.sbc.com...

> You should have told us from the beginning that you only wanted a running
> total. It makes a *HUGE* difference in your design.

Oh I see. I didn't realize.

Again I would suggest
> using data structures rather the arrays. For a running average, a
> doubly-linked array data structure would be ideal.
>
> I already posted a example of using a singly linked data structure to
> find a simple average. It could easily be modified to calculate your
> running average if you also modify it to used a doubly linked list.
>

[snip]

I am kinda struggling with binary search trees right now. Do you think
that design could be implemented into this. I realize too malloc is going to
be needed with the sizeof operator.


Tim Harig

unread,
Jun 27, 2009, 10:36:29 PM6/27/09
to
On 2009-06-28, Bill Cunningham <nos...@nspam.invalid> wrote:
> "Tim Harig" <use...@ilthio.net> wrote in message
> news:eAz1m.1498$cl4...@flpi150.ffdc.sbc.com...
>> Again I would suggest
>> using data structures rather the arrays. For a running average, a
>> doubly-linked array data structure would be ideal.
>
> I am kinda struggling with binary search trees right now. Do you think
> that design could be implemented into this. I realize too malloc is going to
> be needed with the sizeof operator.

You can do just about anything with just about anything if you are will to
try hard enough. The question, therefore, is not *can* something be done
but *should* something be done. All data structures have their own
strengths and weaknesses.

I chose linked lists because they are simple and they are conceptualy
close to what you are trying to do. Linked lists are conceptually
similar to arrays except that they make memory management easier.
They can grow or shrink at will and they can mark their own bounds so
as to prevent overuns.

If you don't need more then the last few entries of the array and can
affort to throw away old data, then you might also consider working with a
linked list formed int a circle. Then you don't have to constantly worry
about find the last few elements in the list. It word work a little like
working around a wrapping shift register.

Skip lists would also be nice to make finding the element numbers that you
want very quick. The look almost like simple linked lists; but, may make
searching much faster. If you give every link an ordinal number then skip
lists would make finding the last 15 elements extremely quick even for
large lists. William Pugh's "Skip Lists: A Probablistic Alternative to
Balanced Trees" is an excellent read. There are several excellent
libraries for working with skip lists available on the Web.

A tree structure removes you conceptually from your problem; but, if you
see a natural paradigm that you can use which keeps things clear, then by
all means use them. Don't just use them because they are the only data
structure that you are familiar with and don't assume that a more
complicated data structure is going to be significantly faster enough to
make the extra complication worth while until you have tried the simpler
solution and found it to be underperforming.

Basically keep your head and use what you think will suit the problem best.

Doug Miller

unread,
Jun 27, 2009, 11:18:54 PM6/27/09
to
I think you need to take a couple deep breaths, relax, sit down, and spend
some time -- thirty minutes or more, not just a couple minutes -- really
thinking about exactly what problem you're trying to solve.

Barry Schwarz

unread,
Jun 28, 2009, 3:04:15 AM6/28/09
to

Well done Bill. You started implying a very simple problem, got a
bunch of people including me to bite, and now have moved on to moving
averages, deleting "obsolete" data, saving the obsolete data in a
file, binary search trees, malloc, and sizeof. And you did this
without ever telling us what you really wanted to do.

Congratulations. One of your best troll baits in years.

Thomas Matthews

unread,
Jun 28, 2009, 3:54:17 AM6/28/09
to
I would change the prototypes:
double Arithmetic_Moving_Average(double * input_data,
unsigned int quantity);
double Exponential_Moving_Average(double * input_data,
unsigned int quantity);

I really, really, hate acronyms and abbreviations, especially
when having to maintain software. Also, since quantities are
usually not negative, an unsigned int, would help provide
compile-time checking (which is a lot more helpful than trying
to find issues during run-time).

Also, the difference in compilation times between using
acronyms and abbreviations is highly negligible compared
to using long descriptive names. There is no difference
in the executable times. HOWEVER, the time required to
decipher "Sma" is a lot longer than "Arithmetic_Moving_Average"
or "ArithmeticMovingAverage".

Try using a lot of comments to describe the process as you
are coding. I find this helps me work out the understanding
and also gives me insight when I look back at the code
after a couple of days on a different project (or being
distracted).

--
Thomas Matthews

C++ newsgroup welcome message:
http://www.slack.net/~shiva/welcome.txt
C++ Faq: http://www.parashift.com/c++-faq-lite
C Faq: http://www.eskimo.com/~scs/c-faq/top.html
alt.comp.lang.learn.c-c++ faq:
http://www.comeaucomputing.com/learn/faq/
Other sites:
http://www.josuttis.com -- C++ STL Library book
http://www.sgi.com/tech/stl -- Standard Template Library

Thad Smith

unread,
Jun 29, 2009, 10:51:30 PM6/29/09
to
Thomas Matthews wrote:
> Bill Cunningham wrote:
>> I want to write a function that takes several doubles to average
>> with an int. An arithmetic mean, exponential mean and geometric mean
>> to get started. These are my prototypes.
>>
>> double Sma (double *,int); /*arithmetic mean */
>> double Ema (double *, int); /* exponential mean */
>>
> I would change the prototypes:
> double Arithmetic_Moving_Average(double * input_data,
> unsigned int quantity);
> double Exponential_Moving_Average(double * input_data,
> unsigned int quantity);
>

I like putting meaningful names on functions and parameters, but in what
sense do the proposed functions perform a moving average?

> Also, the difference in compilation times between using
> acronyms and abbreviations is highly negligible compared
> to using long descriptive names. There is no difference
> in the executable times. HOWEVER, the time required to
> decipher "Sma" is a lot longer than "Arithmetic_Moving_Average"
> or "ArithmeticMovingAverage".

I agree for external function names. The further away they are defined,
the more descriptive should be their names. For very local variables i
and j are fine.

> Try using a lot of comments to describe the process as you
> are coding. I find this helps me work out the understanding
> and also gives me insight when I look back at the code
> after a couple of days on a different project (or being
> distracted).

I agree. In my opinion, the most important comments are on variables,
describing what data is being represented, including units where
appropriate. If you understand the data, figuring out the associated
processing is usually easy.

--
Thad

Tim Harig

unread,
Jun 29, 2009, 11:07:04 PM6/29/09
to
On 2009-06-30, Thad Smith <Thad...@acm.org> wrote:

> Thomas Matthews wrote:
>> Also, the difference in compilation times between using
>> acronyms and abbreviations is highly negligible compared
>> to using long descriptive names. There is no difference
>> in the executable times. HOWEVER, the time required to
>> decipher "Sma" is a lot longer than "Arithmetic_Moving_Average"
>> or "ArithmeticMovingAverage".
>
> I agree for external function names. The further away they are defined,
> the more descriptive should be their names. For very local variables i
> and j are fine.

I have debugged too many pieces of code where variables x,y,i,j,k have
caused bugs. Its far too easy to confuse them and it doesn't take any more
effort to use more descriptive names.

int sequence_index;
int current_object;
etc.

In theory very small functions should be clear even with single char names.
The problem is that simple functions turn into larger functions and people
don't bother to make better variable names as they go. Sooner or later,
somebody mixes up an i and an a j. (see Steve McConnell, _Code Complete_
Chapter 15.2, section "Using Loop Variables")

It is much less effort to do the right thing from the beginning.

Mark L Pappin

unread,
Jul 3, 2009, 6:04:16 AM7/3/09
to
Thad Smith <Thad...@acm.org> writes:

> Thomas Matthews wrote:
>> Bill Cunningham wrote:
>>> I want to write a function that takes several doubles to
>>> average with an int. An arithmetic mean, exponential mean and
>>> geometric mean to get started. These are my prototypes.
>>>
>>> double Sma (double *,int); /*arithmetic mean */
>>> double Ema (double *, int); /* exponential mean */
>>>
>> I would change the prototypes:
>> double Arithmetic_Moving_Average(double * input_data,
>> unsigned int quantity);
>> double Exponential_Moving_Average(double * input_data,
>> unsigned int quantity);
>>
>
> I like putting meaningful names on functions and parameters, but in
> what sense do the proposed functions perform a moving average?

It was squeezed from Bill elsethread, as every detail needs to be.

> If you understand the data,

Bill seldom indicates that he does; usually that he does not.

> figuring out the associated processing is usually easy.

For anyone but Bill.

He's been doing this for years, apparently: vaguely specify what he
wants to do, usually in terms of a couple of language features he
"thinks" will be necessary to do it, and then supply half an answer to
each followup requesting clarification until he starts the cycle again
with a different vague specification. (Note how at no point does he
produce code that implements his spec, or even use what's given to
him.) You know I'm a patient person, Thad, but even I have limits and
Bill managed to hit them about a week after I started my ill-fated
hand-holding expedition with him here.

Just say killfile.

mlp

Mark McIntyre

unread,
Jul 5, 2009, 9:06:08 AM7/5/09
to
Mark L Pappin wrote:
>
> Bill seldom indicates that he does; usually that he does not.

Some years ago, it was indicated by Bill that he has mental health
problems which manifest themselves in terms of memory loss, difficulty
grasping concepts, etc.

Tim Harig

unread,
Jul 5, 2009, 9:58:31 AM7/5/09
to
On 2009-07-05, Mark McIntyre <markmc...@TROUSERSspamcop.net> wrote:
> Some years ago, it was indicated by Bill that he has mental health
> problems which manifest themselves in terms of memory loss, difficulty
> grasping concepts, etc.

That Bill has mental issues is apparent to everybody (it has been mentioned
several times in these two threads [averages and averages2]). The question
is whether those issues are due to intellectual deficiency or simply
behavioral.

I have not been able to find the origional post where Bill indicated the
exact conditions of his supposed illness; though, I have found several
references to it in the usual usenet archives. Most of these references
point to 'short-term' memory problems. I have already commented on the
inconsistancy of his behavior with the observed symptoms of those with
diagnosed 'short-term' memory issues in a sub-thread of averages 2.
Indeed, Bill responded that his memory is good short of three days which
was plenty to keep up with these threads that were less then tree days
apart (and archived if not still on his news server).

The problem has not really been with Bill's memory or comprehension. The
problem has been that Bill is given good suggestions (often with working
code) and then simply dismisses them. When it became almost impossible
mis-comprehend the thread -- Bill just moved to another one where he could
hopefully entice more people into the fray.

The fact that he seems to have been using this behavior for years indicates
that he has had plenty of time, even with memory issues, to progress
beyond the basic level of calculating an average (even a moving average)
and making decent programming decisions. In programming classes that I
have given, calculating an average is one of the first problems that I
assign. Using programming decisions like passing control information as
the first element of an array rather the passing it explicitly, is I style
decision that would mark down even in the code of beginners.

Therefore, if has not been able to figure out one of the most basic
problems in C after years of study, then I would question whether C (or
programming in general) is beyond him.

The fact that he keeps trying and deliberately disregards all suggestions
given to him, along with the fact that he still hasn't produced anything
beyond a really lousy function prototype that most beginners would dismiss
as bad style even after he has been presented with working code examples,
makes me question that his intellect might not be the real problem.

Maybe his problem is simply behavioral.

Don't feed the trolls.

Richard Bos

unread,
Jul 5, 2009, 12:41:19 PM7/5/09
to
Mark McIntyre <markmc...@TROUSERSspamcop.net> wrote:

That may or may not be true, but in any case he is doing the best he can
_not_ to help himself. The way he is trying to learn would be wrong even
if he didn't have any other problems, _and he's been told so_.
Repeatedly. But he refuses to take any kind of advise.
I'm potentially sorry, but if you have mental health problems _and_ you
refuse to follow good advise, then the former is not your greatest
problem.

Richard

Default User

unread,
Jul 6, 2009, 2:21:57 PM7/6/09
to
Tim Harig wrote:


> The fact that he seems to have been using this behavior for years
> indicates that he has had plenty of time, even with memory issues, to
> progress beyond the basic level of calculating an average (even a
> moving average) and making decent programming decisions.

I believe, but can't really demonstrate, that Bill's purported C
knowledge level was greater ten years or so back when he first started
posting. Unfortunately, Google Groups search is so broken these days
that I can't find any of those older messages to check my memory.

> Don't feed the trolls.

That was the conclusion I came to. Others feel differently.


Brian

--
Day 154 of the "no grouchy usenet posts" project

Mark McIntyre

unread,
Jul 6, 2009, 6:29:12 PM7/6/09
to
Richard Bos wrote:
> Mark McIntyre <markmc...@TROUSERSspamcop.net> wrote:
>
>> Mark L Pappin wrote:
>>> Bill seldom indicates that he does; usually that he does not.
>> Some years ago, it was indicated by Bill that he has mental health
>> problems which manifest themselves in terms of memory loss, difficulty
>> grasping concepts, etc.
>
> That may or may not be true, but in any case he is doing the best he can
> _not_ to help himself. The way he is trying to learn would be wrong even
> if he didn't have any other problems, _and he's been told so_.

I agree with all this, but...

> Repeatedly. But he refuses to take any kind of advise.
> I'm potentially sorry, but if you have mental health problems _and_ you
> refuse to follow good advise,

... just FYI, it is often the case that a sufferer is in fact unable to
follow good advice precisely because of the nature of their illness.
Consider that its good advice not to bleed profusely, yet someone with
thrombocytopenia can't help it.

And if you have severe memory loss issues....

--
Mark McIntyre

CLC FAQ <http://c-faq.com/>
CLC readme: <http://www.ungerhu.com/jxh/clc.welcome.txt>

Kaz Kylheku

unread,
Jul 6, 2009, 6:50:29 PM7/6/09
to
On 2009-07-05, Tim Harig <use...@ilthio.net> wrote:
> On 2009-07-05, Mark McIntyre <markmc...@TROUSERSspamcop.net> wrote:
>> Some years ago, it was indicated by Bill that he has mental health
>> problems which manifest themselves in terms of memory loss, difficulty
>> grasping concepts, etc.
>
> That Bill has mental issues is apparent to everybody (it has been mentioned
> several times in these two threads [averages and averages2]). The question
> is whether those issues are due to intellectual deficiency or simply
> behavioral.
>
> I have not been able to find the origional post where Bill indicated the
> exact conditions of his supposed illness; though, I have found several
> references to it in the usual usenet archives. Most of these references
> point to 'short-term' memory problems.

Short term memory problems could result in repetitive behavior. In order to
make a resolution to change your behavior, you require memory. If tomorrow you
don't remember that you made a resolution, then you can't possibly keep it.

> The problem has not really been with Bill's memory or comprehension. The
> problem has been that Bill is given good suggestions (often with working
> code) and then simply dismisses them. When it became almost impossible
> mis-comprehend the thread -- Bill just moved to another one where he could
> hopefully entice more people into the fray.

Even if Bill realizes that this behavior is counterproductive and makes
a resolution to change it, he will forget it in a few days (supposedly).

> The fact that he seems to have been using this behavior for years indicates
> that he has had plenty of time, even with memory issues, to progress
> beyond the basic level of calculating an average (even a moving average)
> and making decent programming decisions.

Not really. If his memory disappears after three days, then, in spite of the
passage of years, he has only retained the last three days. The last five or
ten years essentially didn't happen at all.

If he were to understand everything from all those years, it would have to be
condensed into three days worth of reading, in a way that he can understand in
three days. By which time, he would be forgetting the beginning of it already.

In the software field, a good memory is of tremendous value, and one that we
easily take for granted when we have it.

> Maybe his problem is simply behavioral.

I don't think you can cleanly separate cognitive and behavioral/psychological
issues.

> Don't feed the trolls.

Though Bill might not be a troll, the waste of time is the same.

Where is the satifaction in instructing someone, if it evaporates in several
days?

Doug Miller

unread,
Jul 6, 2009, 6:56:56 PM7/6/09
to
In article <_Uu4m.230303$op1....@en-nntp-05.dc1.easynews.com>, Mark McIntyre <markmc...@TROUSERSspamcop.net> wrote:

>.... just FYI, it is often the case that a sufferer is in fact unable to

>follow good advice precisely because of the nature of their illness.
>Consider that its good advice not to bleed profusely, yet someone with
>thrombocytopenia can't help it.

This can be a hard concept to grasp, for those who have no personal experience
with such illnesses. I have two close relatives who have struggled for years
with depression. They can't "just snap out of it" as some well-intentioned but
grossly uninformed people have told them to do.


>
>And if you have severe memory loss issues....
>

On the other hand, as applies to Bill specifically, this entire exchange, and
the many which have preceded it, take place solely through the medium of the
written word -- the entire purpose of which is to obviate the *need* to
remember. One would expect that a person who *knows* he has memory issues
might at least make an effort to peruse the written history of the many
responses he has received in the past.

Ben Bacarisse

unread,
Jul 6, 2009, 7:58:29 PM7/6/09
to
Kaz Kylheku <kkyl...@gmail.com> writes:
<snip>

> Though Bill might not be a troll, the waste of time is the same.
>
> Where is the satifaction in instructing someone, if it evaporates in several
> days?

http://www.youtube.com/watch?v=nZY5Oz8TAMM

--
Ben.

Tim Harig

unread,
Jul 6, 2009, 8:27:14 PM7/6/09
to
On 2009-07-06, Kaz Kylheku <kkyl...@gmail.com> wrote:
> On 2009-07-05, Tim Harig <use...@ilthio.net> wrote:
>> On 2009-07-05, Mark McIntyre <markmc...@TROUSERSspamcop.net> wrote:
>>> Some years ago, it was indicated by Bill that he has mental health
>>> problems which manifest themselves in terms of memory loss, difficulty
>>> grasping concepts, etc.
>> That Bill has mental issues is apparent to everybody (it has been mentioned
>> several times in these two threads [averages and averages2]). The question
>> is whether those issues are due to intellectual deficiency or simply
>> behavioral.
>> I have not been able to find the origional post where Bill indicated the
>> exact conditions of his supposed illness; though, I have found several
>> references to it in the usual usenet archives. Most of these references
>> point to 'short-term' memory problems.
> Short term memory problems could result in repetitive behavior. In order to
> make a resolution to change your behavior, you require memory. If tomorrow you
> don't remember that you made a resolution, then you can't possibly keep it.

Presumably, if his disorder is that problematic, then:

1. He probably is receiving some kind of assitance for it.

2. He isn't likely to be in a position, such as a programming job,
where memory is extremely important to doing his job.

>> The fact that he seems to have been using this behavior for years indicates
>> that he has had plenty of time, even with memory issues, to progress
>> beyond the basic level of calculating an average (even a moving average)
>> and making decent programming decisions.
> Not really. If his memory disappears after three days, then, in spite of the
> passage of years, he has only retained the last three days. The last five or
> ten years essentially didn't happen at all.

Memory and learning have been proven to be separate. People left with
no long term or short term memory after head injuries can learn to do
tasks more effectively even though they may not remember that they did the
task before.

This is not to say that he may not have other problems *including* a memory
issue; but, it indicates that he does not have a memory issue alone.

> If he were to understand everything from all those years, it would have to be
> condensed into three days worth of reading, in a way that he can understand in
> three days. By which time, he would be forgetting the beginning of it already.

If you look at the other thread "averages 2" that he started, the poor
quality code that he posted was not a memory problem -- it was a
judgemental error. He had all the elements necessary to do the task
displayed, proving the he know the syntax; yet, he chose an extremely poor
style of coding. Thats not a memory error.

> In the software field, a good memory is of tremendous value, and one that we
> easily take for granted when we have it.

Appsolutely and if his problems are that severe then he is in way over his
head and he doesn't need to be programming -- especially in C. If what he
has posted is representative of his ability; then, he will never be able to
program anything beyond the merely trivial.

>> Maybe his problem is simply behavioral.
> I don't think you can cleanly separate cognitive and behavioral/psychological
> issues.

I don't doubt that he may have issues. I do point out that memory issues
tend to have very specific symptoms which tend to be very distinct from
behavioral issues. I have already stated elsewhere that other issues are
far more difficult to distinguish. It may be that he also has memory
issues to go along with the rest; but, memory issues alone cannot account
for his behaviors.

>> Don't feed the trolls.
> Though Bill might not be a troll, the waste of time is the same.
> Where is the satifaction in instructing someone, if it evaporates in several
> days?

This is the heart of the matter. If his problems are as severe as he
indicates (whether caused by memory or other problems) and as the lack
of understanding of the simplest of programming concepts suggests; then,
he needs to seek professional help (read: "not help from usenet").

Whatever the problems, I don't see any point in encouraging bad behavior by
coddling him.

Bill Cunningham

unread,
Jul 9, 2009, 5:58:41 PM7/9/09
to

"Mark McIntyre" <markmc...@TROUSERSspamcop.net> wrote in message
news:4z14m.269477$Lo1....@en-nntp-04.dc1.easynews.com...

I frequently go to a restauraunt and decided I wanted to refill my soda.
So I got up and entered the restroom. Upon realizing this was not where I
was to fill my drink I went up front to get a refill. I have also given up
driving as I will drive around racking my brain trying to figure out how to
get where I'm going. I have lived in this town my whole life. Such is the
effect of klonopin on me.

Bill


Bill Cunningham

unread,
Jul 9, 2009, 6:03:00 PM7/9/09
to

"Tim Harig" <use...@ilthio.net> wrote in message
news:bk24m.3437$bq1....@nlpi066.nbdc.sbc.com...

> On 2009-07-05, Mark McIntyre <markmc...@TROUSERSspamcop.net> wrote:

> The problem has not really been with Bill's memory or comprehension.

Oh really Doc?

The
> problem has been that Bill is given good suggestions (often with working
> code) and then simply dismisses them.

Too many suggestions at times. Not always good. I can't follow 5
people's 5 different opinions. Usenet is not a good place to learn C but get
*specific* help with issuses. SPECIFIC ISSUSES. When it became almost

impossible
> mis-comprehend the thread -- Bill just moved to another one where he could
> hopefully entice more people into the fray.

The less people who respond the better.


Bill Cunningham

unread,
Jul 9, 2009, 6:09:48 PM7/9/09
to

"Tim Harig" <use...@ilthio.net> wrote in message
news:CDw4m.11232$aX1....@nlpi067.nbdc.sbc.com...

> Presumably, if his disorder is that problematic, then:
>
> 1. He probably is receiving some kind of assitance for it.

US social security disability

> 2. He isn't likely to be in a position, such as a programming job,
> where memory is extremely important to doing his job.

I what to learn to prgram. I mastered basic. In time I will C. With or
without help.

>>> The fact that he seems to have been using this behavior for years
>>> indicates
>>> that he has had plenty of time, even with memory issues, to progress
>>> beyond the basic level of calculating an average (even a moving average)
>>> and making decent programming decisions.
>> Not really. If his memory disappears after three days, then, in spite of
>> the
>> passage of years, he has only retained the last three days. The last five
>> or
>> ten years essentially didn't happen at all.

IQ is 100

Diagnosed with clinical major depression.

> Memory and learning have been proven to be separate. People left with
> no long term or short term memory after head injuries can learn to do
> tasks more effectively even though they may not remember that they did the
> task before.
>
> This is not to say that he may not have other problems *including* a
> memory
> issue; but, it indicates that he does not have a memory issue alone.
>
>> If he were to understand everything from all those years, it would have
>> to be
>> condensed into three days worth of reading, in a way that he can
>> understand in
>> three days. By which time, he would be forgetting the beginning of it
>> already.
>
> If you look at the other thread "averages 2" that he started, the poor
> quality code that he posted was not a memory problem -- it was a
> judgemental error. He had all the elements necessary to do the task
> displayed, proving the he know the syntax; yet, he chose an extremely poor
> style of coding. Thats not a memory error.

I like KandR Coding style.

>> In the software field, a good memory is of tremendous value, and one that
>> we
>> easily take for granted when we have it.
>
> Appsolutely and if his problems are that severe then he is in way over his
> head and he doesn't need to be programming -- especially in C. If what he
> has posted is representative of his ability; then, he will never be able
> to
> program anything beyond the merely trivial.
>
>>> Maybe his problem is simply behavioral.
>> I don't think you can cleanly separate cognitive and
>> behavioral/psychological
>> issues.
>
> I don't doubt that he may have issues. I do point out that memory issues
> tend to have very specific symptoms which tend to be very distinct from
> behavioral issues. I have already stated elsewhere that other issues are
> far more difficult to distinguish. It may be that he also has memory
> issues to go along with the rest; but, memory issues alone cannot account
> for his behaviors.
>
>>> Don't feed the trolls.

The biggest fear in life to all on clc. Except me seems to be if someone
is a troll. 3/5 your will be called a troll. 2/5 of the time tolerated. The
G8 summit's major concern? Who on usenet and clc is a troll.

<snicker>

Bill


Tim Harig

unread,
Jul 9, 2009, 6:09:03 PM7/9/09
to
On 2009-07-09, Bill Cunningham <nos...@nspam.invalid> wrote:
> "Mark McIntyre" <markmc...@TROUSERSspamcop.net> wrote in message
> news:4z14m.269477$Lo1....@en-nntp-04.dc1.easynews.com...
>> Mark L Pappin wrote:
>>> Bill seldom indicates that he does; usually that he does not.
>> Some years ago, it was indicated by Bill that he has mental health
>> problems which manifest themselves in terms of memory loss, difficulty
>> grasping concepts, etc.
> driving as I will drive around racking my brain trying to figure out how to
> get where I'm going. I have lived in this town my whole life. Such is the
> effect of klonopin on me.

That being the case, maybe, programming is not such a good occupation for
you.

Bill C{unningham]

unread,
Jul 9, 2009, 6:11:51 PM7/9/09
to
WARNING:

I am changing my name here to Bill C. Please update your killfiles and
respond to Bill C.

See the above old averages thread for this topic.

Bill


Tim Harig

unread,
Jul 9, 2009, 6:18:24 PM7/9/09
to
On 2009-07-09, Bill Cunningham <nos...@nspam.invalid> wrote:
> "Tim Harig" <use...@ilthio.net> wrote in message
> news:bk24m.3437$bq1....@nlpi066.nbdc.sbc.com...
>> On 2009-07-05, Mark McIntyre <markmc...@TROUSERSspamcop.net> wrote:
>> problem has been that Bill is given good suggestions (often with working
>> code) and then simply dismisses them.
> Too many suggestions at times. Not always good. I can't follow 5
> people's 5 different opinions. Usenet is not a good place to learn C but get
> *specific* help with issuses. SPECIFIC ISSUSES. When it became almost
> impossible
> The less people who respond the better.

1. With you, because your code is so terrible to begin with, there doesn't
ever seem to be a single SPECIFIC issue.

2. Usenet is a free forum. When asking questions you get what people
are kind enough to volunteer.

3. Given your disability, it would seem that programming is not a very
productive vocation for you.

4. Given the above, should you decide that you really want to spend the
rest of your life making trivial pieces of C code, perhaps you
would be more comfortable finding a tutor that could cater to your
specific needs.

Tim Harig

unread,
Jul 9, 2009, 6:25:32 PM7/9/09
to
On 2009-07-09, Bill Cunningham <nos...@nspam.invalid> wrote:
> "Tim Harig" <use...@ilthio.net> wrote in message
> news:CDw4m.11232$aX1....@nlpi067.nbdc.sbc.com...
>> If you look at the other thread "averages 2" that he started, the poor
>> quality code that he posted was not a memory problem -- it was a
>> judgemental error. He had all the elements necessary to do the task
>> displayed, proving the he know the syntax; yet, he chose an extremely poor
>> style of coding. Thats not a memory error.
> I like KandR Coding style.

Trying to subvertly pass an argument as the first element of an array is
*not* KandR style.

Bill C[unningham]

unread,
Jul 9, 2009, 6:27:55 PM7/9/09
to

"Tim Harig" <use...@ilthio.net> wrote in message
news:3Ut5m.2686$Wj7....@nlpi065.nbdc.sbc.com...

> That being the case, maybe, programming is not such a good occupation for
> you.

I don't really want to persue it as a career. I have been on .5 mg of
klonopin before and the change is pretty substantial. Now I take 1mg ter in
die. My IQ is great and I seem to be smart but terribly confused. I walk in
a trance. I don't know if this will subside so much later on if I can drop
the dosage or not.

Bill


Bill C[unningham]

unread,
Jul 9, 2009, 6:53:56 PM7/9/09
to

"Tim Harig" <use...@ilthio.net> wrote in message
news:w7u5m.2689$Wj7....@nlpi065.nbdc.sbc.com...

> Trying to subvertly pass an argument as the first element of an array is
> *not* KandR style.

I'm not quite sure of what bad coding means then. I prefer this for
example.

double x=strtod
double y=strtod

I get advice saying that's improper style. I an not a professional and
don't know enough about C to use ? and : but I do know +=. People will argue
that I should use.

double x,y;
x=strtod
y=strtod

Or += instead of sum+sum=figure.

These things seem trivial to me so I do it the way I want and someone isn't
happy. That's my understanding of this.

Bill


Keith Thompson

unread,
Jul 9, 2009, 7:03:18 PM7/9/09
to
"Bill C{unningham]" <nos...@nspam.invalid> writes:
> WARNING:
>
> I am changing my name here to Bill C.
[...]

Why?

--
Keith Thompson (The_Other_Keith) ks...@mib.org <http://www.ghoti.net/~kst>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"

Bill C[unningham]

unread,
Jul 9, 2009, 7:40:09 PM7/9/09
to

"Keith Thompson" <ks...@mib.org> wrote in message
news:lneispz...@nuthaus.mib.org...

>> I am changing my name here to Bill C.
> [...]
>
> Why?

It seems like most people here(although a few don't) use their real
name. I thought maybe an alias would be more proper. Maybe I should keep it
the same then for now anyway. I might just keep it the same.

Bill


Keith Thompson

unread,
Jul 9, 2009, 8:17:41 PM7/9/09
to
"Bill C[unningham]" <nos...@nspam.invalid> writes:

Some people use aliases, but there's no reason not to use your real
name. Just leave it alone.

Mark L Pappin

unread,
Jul 9, 2009, 8:46:36 PM7/9/09
to
"Bill C[unningham]" <nos...@nspam.invalid> writes:

> "Tim Harig" <use...@ilthio.net> wrote:
>
>> That being the case, maybe, programming is not such a good
>> occupation for you.
>
> I don't really want to persue it as a career.

I'm sure Tim means "occupation" in the sense "activity occupying
time", not "career".

You're not making enough progress to justify it even as a casual
hobby.

You blatantly ignore explicit instructions to answer specific
questions about your aims with a given piece of code, or to correct
specific problems with a given piece of code. You make no progress.

Trying to help you was intellectually stimulating for the first couple
of days, but once I saw that your behaviour didn't change even after
you agreed to try to concentrate on just the tutorial examples I
posted for you, it stopped being a rewarding experience for me so I
gave up - I'm not into sadistic necrophiliac bestiality.

> I have been on .5 mg of klonopin before and the change is pretty
> substantial. Now I take 1mg ter in die.

The issue of what drugs you may or may not be taking is between you
and your doctor. It's a human version of the "as-if" rule: if you
behave as if you're a troll, it doesn't matter if you're on drugs or
not; ditto behaving as a rational human with good programming skills.
We don't know or care what drugs Dennis, Dan, Kaz, Lawrence*, Keith,
Eric, Richard*, Mark*, Han, or Antoninus are on - their apparent
behaviour here defines them, as far as we're concerned.

> My IQ is great

If it's 100, as you stated in another poorly-snipped response
elsethread, then it's most definitely NOT great - it's average by
definition, and a more accurate statement might be "My IQ is OK"

> and I seem to be smart but terribly confused.

No you don't, and yes you do.

I promised myself I wouldn't read any more of your postings. Now I'll
try a second time to keep that promise.

mlp

* not a footnote marker - a wildcard

Barry Schwarz

unread,
Jul 9, 2009, 10:05:09 PM7/9/09
to

Congratulations. You have taken a completely irrelevant discussion
and made four separate threads out of it. A neat feat considering the
title only has one word.

--
Remove del for email

Chris M. Thomasson

unread,
Jul 10, 2009, 1:24:06 AM7/10/09
to
"Bill Cunningham" <nos...@nspam.invalid> wrote in message
news:4a566818$0$23742$bbae...@news.suddenlink.net...

It sounds like that particular drug is working out for you perfectly...
Please don't drive on that shi%! Talk to your doctor; perhaps a session or
two of insulin coma therapy might work.

BTW, do you abuse your sedatives?

Bill Cunningham

unread,
Jul 10, 2009, 1:54:18 AM7/10/09
to

"Chris M. Thomasson" <n...@spam.invalid> wrote in message
news:h36j9b$e0d$1...@news.ett.com.ua...

> BTW, do you abuse your sedatives?

I take 1 mg 3x a day. And it keeps me from drawing up and freaking out.
Now I have diabetes militus and high BP too.

The way to get off this class IV drug is very slowly titrating down the
dosage.

Bill

Nick Keighley

unread,
Jul 10, 2009, 10:35:02 AM7/10/09
to
On 9 July, 23:53, "Bill C[unningham]" <nos...@nspam.invalid> wrote:
> "Tim Harig" <user...@ilthio.net> wrote in message
> news:w7u5m.2689$Wj7....@nlpi065.nbdc.sbc.com...

Bill claims to write K&R C. This usually refers to the first edition
of K&R C. Pre the ANSI standard.

You don't write C in this style you write a bad mix
of C89 (so-called ANSI) and C99. Your layout is often bad
as well.

> > Trying to subvertly pass an argument as the first element of an array is
> > *not* KandR style.

it is just bad design

>     I'm not quite sure of what bad coding means then. I prefer this for
> example.
>
> double x=strtod
> double y=strtod

that's a syntax error in all versions of C.

double x = strtod (strptr, NULL);

>     I get advice saying that's improper style. I an not a professional and
> don't know enough about C to use ? and : but I do know +=. People will argue
> that I should use.
>
> double x,y;
> x=strtod
> y=strtod

again a syntax error. C89 doesn't allow the first version.
C99 does. Nothing to do with K&R C.

> Or += instead of sum+sum=figure.

that's *another* syntax error. You meant
sum += figure;
instead of
sum = sum + figure;

The += version is shorter. If sum is a complex expression then
it may save evaluating something twice. I wouldn't fail
code in review for failing to use +=

> These things seem trivial to me so I do it the way I want and someone isn't
> happy. That's my understanding of this.

to an extent true. but why ask advice if you take it?

Default User

unread,
Jul 10, 2009, 12:53:50 PM7/10/09
to
Mark L Pappin wrote:

> We don't know or care what drugs Dennis, Dan, Kaz, Lawrence*, Keith,
> Eric, Richard*, Mark*, Han, or Antoninus are on - their apparent
> behaviour here defines them, as far as we're concerned.

> * not a footnote marker - a wildcard

I think "Richard" should get two wildcards, just for the sheer number
of Richards. This is far and away the Richardiest newsgroup that I read.


Brian

--
Day 158 of the "no grouchy usenet posts" project

Bill Cunningham

unread,
Jul 10, 2009, 2:56:31 PM7/10/09
to

"Nick Keighley" <nick_keigh...@hotmail.com> wrote in message
news:25c4830a-4f24-4c2d...@g31g2000yqc.googlegroups.com...

On 9 July, 23:53, "Bill C[unningham]" <nos...@nspam.invalid> wrote:
> "Tim Harig" <user...@ilthio.net> wrote in message
> news:w7u5m.2689$Wj7....@nlpi065.nbdc.sbc.com...

Bill claims to write K&R C. This usually refers to the first edition
of K&R C. Pre the ANSI standard.

You don't write C in this style you write a bad mix
of C89 (so-called ANSI) and C99. Your layout is often bad
as well.

> > Trying to subvertly pass an argument as the first element of an array is
> > *not* KandR style.

it is just bad design

> I'm not quite sure of what bad coding means then. I prefer this for
> example.
>
> double x=strtod
> double y=strtod

that's a syntax error in all versions of C.

I understand what your trying to say. But for brevity I left off the
parameters. Perhaps I should've wrote...

double x=strtod(argv[1],NULL);
Which is the way I normally call this function.

[snip]


Richard Bos

unread,
Jul 10, 2009, 5:32:38 PM7/10/09
to
Mark McIntyre <markmc...@TROUSERSspamcop.net> wrote:

> Richard Bos wrote:
> > Repeatedly. But he refuses to take any kind of advise.
> > I'm potentially sorry, but if you have mental health problems _and_ you
> > refuse to follow good advise,
>
> ... just FYI, it is often the case that a sufferer is in fact unable to
> follow good advice precisely because of the nature of their illness.
> Consider that its good advice not to bleed profusely, yet someone with
> thrombocytopenia can't help it.

Oh, come on! You're not suggesting that Bill is haemorrhaging out of his
particle of common sense, are you?

> And if you have severe memory loss issues....

... you _don't know_ that you have them. Bill knows that he has problems
concentrating, but conveniently forgets it every time he chucks together
another bunch of junk code to put up on c.l.c. And then equally
conveniently remembers it when he's called to task over it. That's not
memory loss or confusion, that's an attitude problem.

Richard

Mark McIntyre

unread,
Jul 10, 2009, 6:19:27 PM7/10/09
to
Richard Bos wrote:
> Mark McIntyre <markmc...@TROUSERSspamcop.net> wrote:
>
>> ... just FYI, it is often the case that a sufferer is in fact unable to
>> follow good advice precisely because of the nature of their illness.
>> Consider that its good advice not to bleed profusely, yet someone with
>> thrombocytopenia can't help it.
>
> Oh, come on! You're not suggesting that Bill is haemorrhaging out of his
> particle of common sense, are you?

I believe you understood the metaphor perfectly. Pretending otherwise is
either childish or trollish, and IDGAFFW.

>> And if you have severe memory loss issues....
>
> ... you _don't know_ that you have them.

And which university is your degree in brain disorders from? I'd like to
know so I can forbid my children from studying there.

Cluefest: forgetting stuff and knowing you forget stuff are not mutually
exclusive. Who amongst us hasn't walked into the kitchen and thought to
themselves "dang, I have no idea what I came through for".

Message has been deleted

Nick Keighley

unread,
Jul 11, 2009, 7:13:22 AM7/11/09
to
On 10 July, 19:56, "Bill Cunningham" <nos...@nspam.invalid> wrote:
> "Nick Keighley" <nick_keighley_nos...@hotmail.com> wrote in message

> news:25c4830a-4f24-4c2d...@g31g2000yqc.googlegroups.com...
> On 9 July, 23:53, "Bill C[unningham]" <nos...@nspam.invalid> wrote:
> > "Tim Harig" <user...@ilthio.net> wrote in message
> >news:w7u5m.2689$Wj7....@nlpi065.nbdc.sbc.com...

> Bill claims to write K&R C. This usually refers to the first edition
> of K&R C. Pre the ANSI standard.

Oh for F***'s sake! Get the bloody quoting right!
Do it by hand if necessary.

> You don't write C in this style[,] you write a bad mix


> of C89 (so-called ANSI) and C99. Your layout is often bad
> as well.
>
> > > Trying to subvertly pass an argument as the first element of an array is
> > > *not* KandR style.
>
> it is just bad design
>
> > I'm not quite sure of what bad coding means then. I prefer this for
> > example.
>
> > double x=strtod
> > double y=strtod
>
> that's a syntax error in all versions of C.
>
>     I understand what your trying to say. But for brevity I left off the
> parameters. Perhaps I should've wrote...

strtod on it's own isn't a function call, its a pointer to
a function (and if you don't know what one of those is then
don't worry)

> double x=strtod(argv[1],NULL);
> Which is the way I normally call this function.


I will avoid replying to you for at least a week as you beginning to
bug me.

Nick Keighley

unread,
Jul 11, 2009, 7:16:37 AM7/11/09
to
On 11 July, 08:58, Mark L Pappin <m...@acm.org> wrote:

> "Default User" <defaultuse...@yahoo.com> writes:
> > Mark L Pappin wrote:
>
> >> We don't know or care what drugs Dennis, Dan, Kaz, Lawrence*, Keith,
> >> Eric, Richard*, Mark*, Han, or Antoninus are on - their apparent
> >> behaviour here defines them, as far as we're concerned.
>
> >> * not a footnote marker - a wildcard
>
> > I think "Richard" should get two wildcards, just for the sheer number
> > of Richards. This is far and away the Richardiest newsgroup that I read.
>
> It's also fairly Marky, I've noticed.  Talk to Flash.
>
> ObMarkness (since we're already OT):
> I was at a school whose principal's name was Mark.  Since I was
> nearest the office phone when it rang, I did the Right Thing and
> answered it.  On the other end was another principal, also name of
> Mark, who mis-assumed that I was the local principal.  I got to say
> "Sorry Mark, you've got the wrong Mark.  I'll go get Mark."

I lived in a shared house that had two Nicks, a Mick, and a Dick.
Answering the phone took time...

Bill Cunningham

unread,
Jul 12, 2009, 3:04:38 PM7/12/09
to

"Mark McIntyre" <markmc...@TROUSERSspamcop.net> wrote in message
news:R7P5m.353159$6p1....@en-nntp-02.dc1.easynews.com...

> Cluefest: forgetting stuff and knowing you forget stuff are not mutually
> exclusive. Who amongst us hasn't walked into the kitchen and thought to
> themselves "dang, I have no idea what I came through for".

Yes indeed. But do you do it atleast 6 times a day? Look at the
sideeffects of klonopin. That explains things.

Bill


Phil Carmody

unread,
Jul 13, 2009, 12:07:24 PM7/13/09
to
"Bill C[unningham]" <nos...@nspam.invalid> writes:
[SNIP - don't know, don't care]

It morphs. Good enough proof of trolldom for many.

Phil
--
Marijuana is indeed a dangerous drug.
It causes governments to wage war against their own people.
-- Dave Seaman (sci.math, 19 Mar 2009)

Mark McIntyre

unread,
Jul 13, 2009, 6:12:13 PM7/13/09
to
Bill Cunningham wrote:
> "Mark McIntyre" <markmc...@TROUSERSspamcop.net> wrote in message
> news:R7P5m.353159$6p1....@en-nntp-02.dc1.easynews.com...
>
>> Cluefest: forgetting stuff and knowing you forget stuff are not mutually
>> exclusive. Who amongst us hasn't walked into the kitchen and thought to
>> themselves "dang, I have no idea what I came through for".
>
> Yes indeed. But do you do it atleast 6 times a day?

No, but my dad does.

Richard Bos

unread,
Jul 14, 2009, 3:16:32 PM7/14/09
to
Mark McIntyre <markmc...@TROUSERSspamcop.net> wrote:

> Richard Bos wrote:
> > Mark McIntyre <markmc...@TROUSERSspamcop.net> wrote:
> >
> >> ... just FYI, it is often the case that a sufferer is in fact unable to
> >> follow good advice precisely because of the nature of their illness.
> >> Consider that its good advice not to bleed profusely, yet someone with
> >> thrombocytopenia can't help it.
> >
> > Oh, come on! You're not suggesting that Bill is haemorrhaging out of his
> > particle of common sense, are you?
>
> I believe you understood the metaphor perfectly.

Of course I did. That's why I replied with an equally broken one.

> Cluefest: forgetting stuff and knowing you forget stuff are not mutually
> exclusive.

Cluefest squared: holes in your memory are never _conveniently_ on and
off.

Richard

0 new messages