469,621 Members | 1,853 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,621 developers. It's quick & easy.

Re: What am I doing wrong?

On 2008-07-06 21:09:55 +0100, Joe Wright <jo********@comcast.netsaid:
Do you agree that ..

member,first,mi,last,dob,eff_date,exp_date
1,John,,Doe,07/04/1776,01/01/1800,
2,Mack,T,Knife,11/11/1918,10/1/1939,5/25/2005

.. might be the contents of your CSV file?
Err, no not really as that has nothing to do with stock market prices :).
--
"I disapprove of what you say, but I'll defend to the death your right
to say it." - Voltaire

Jul 6 '08 #1
25 2247
Cromulent wrote:
On 2008-07-06 21:09:55 +0100, Joe Wright <jo********@comcast.netsaid:
>Do you agree that ..

member,first,mi,last,dob,eff_date,exp_date
1,John,,Doe,07/04/1776,01/01/1800,
2,Mack,T,Knife,11/11/1918,10/1/1939,5/25/2005

.. might be the contents of your CSV file?

Err, no not really as that has nothing to do with stock market prices :).
Of course. I was talking about the format of the file. In the case of
Microsoft Excel, Visual FoxPro and perhaps Access, CSV files are text
representations of tables. The first row (line) of the CSV file are the
names of the columns and subsequent lines are the values of the columns.

Is this the kind of CSV file you are talking about or do you have some
other idea?
--
Joe Wright
"Everything should be made as simple as possible, but not simpler."
--- Albert Einstein ---
Jul 6 '08 #2
On 2008-07-06 22:11:48 +0100, Joe Wright <jo********@comcast.netsaid:
Cromulent wrote:
>On 2008-07-06 21:09:55 +0100, Joe Wright <jo********@comcast.netsaid:
>>Do you agree that ..

member,first,mi,last,dob,eff_date,exp_date
1,John,,Doe,07/04/1776,01/01/1800,
2,Mack,T,Knife,11/11/1918,10/1/1939,5/25/2005

.. might be the contents of your CSV file?

Err, no not really as that has nothing to do with stock market prices :).

Of course. I was talking about the format of the file. In the case of
Microsoft Excel, Visual FoxPro and perhaps Access, CSV files are text
representations of tables. The first row (line) of the CSV file are the
names of the columns and subsequent lines are the values of the columns.

Is this the kind of CSV file you are talking about or do you have some
other idea?
Ah, I see. Yes that is exactly the type of data I will be using. Here
is an example:

Date,Open,High,Low,Close,Volume
3-Jul-08,0.80,1.09,0.80,1.09,77800
2-Jul-08,1.08,1.09,0.56,0.94,19600
1-Jul-08,1.09,1.09,0.95,1.08,29700
30-Jun-08,0.80,1.09,0.75,1.09,11500
--
"I disapprove of what you say, but I'll defend to the death your right
to say it." - Voltaire

Jul 6 '08 #3
Cromulent wrote:
On 2008-07-06 22:11:48 +0100, Joe Wright <jo********@comcast.netsaid:
>Cromulent wrote:
>>On 2008-07-06 21:09:55 +0100, Joe Wright <jo********@comcast.netsaid:
Do you agree that ..

member,first,mi,last,dob,eff_date,exp_date
1,John,,Doe,07/04/1776,01/01/1800,
2,Mack,T,Knife,11/11/1918,10/1/1939,5/25/2005

.. might be the contents of your CSV file?

Err, no not really as that has nothing to do with stock market prices
:).

Of course. I was talking about the format of the file. In the case of
Microsoft Excel, Visual FoxPro and perhaps Access, CSV files are text
representations of tables. The first row (line) of the CSV file are
the names of the columns and subsequent lines are the values of the
columns.

Is this the kind of CSV file you are talking about or do you have some
other idea?

Ah, I see. Yes that is exactly the type of data I will be using. Here is
an example:

Date,Open,High,Low,Close,Volume
3-Jul-08,0.80,1.09,0.80,1.09,77800
2-Jul-08,1.08,1.09,0.56,0.94,19600
1-Jul-08,1.09,1.09,0.95,1.08,29700
30-Jun-08,0.80,1.09,0.75,1.09,11500
Ok, thanks. I deal with these .csv files every day at my job. I haven't
used strtok() in twenty years, since I figured out how it works.

Given your example file, what do you want to do with the data?

--
Joe Wright
"Everything should be made as simple as possible, but not simpler."
--- Albert Einstein ---
Jul 6 '08 #4
On 2008-07-07 00:06:09 +0100, Joe Wright <jo********@comcast.netsaid:
>
>>
Ah, I see. Yes that is exactly the type of data I will be using. Here
is an example:

Date,Open,High,Low,Close,Volume
3-Jul-08,0.80,1.09,0.80,1.09,77800
2-Jul-08,1.08,1.09,0.56,0.94,19600
1-Jul-08,1.09,1.09,0.95,1.08,29700
30-Jun-08,0.80,1.09,0.75,1.09,11500

Ok, thanks. I deal with these .csv files every day at my job. I haven't
used strtok() in twenty years, since I figured out how it works.

Given your example file, what do you want to do with the data?
Basically I want to split the component parts up. I want to keep the
date and convert it to a useable form and then take each of the other
components (open, high, low etc) and put them in the appropriate
variable type. Then once I have all of them I want to be able to do
certain mathmatically functions. To give a very simple example I want
to be able to work out the moving average with the given data.
--
"I disapprove of what you say, but I'll defend to the death your right
to say it." - Voltaire

Jul 7 '08 #5
Cromulent wrote:
Joe Wright <jo********@comcast.netsaid:
>>Ah, I see. Yes that is exactly the type of data I will be using.
Here is an example:

Date,Open,High,Low,Close,Volume
3-Jul-08,0.80,1.09,0.80,1.09,77800
2-Jul-08,1.08,1.09,0.56,0.94,19600
1-Jul-08,1.09,1.09,0.95,1.08,29700
30-Jun-08,0.80,1.09,0.75,1.09,11500

Ok, thanks. I deal with these .csv files every day at my job. I
haven't used strtok() in twenty years, since I figured out how
it works.

Given your example file, what do you want to do with the data?

Basically I want to split the component parts up. I want to keep
the date and convert it to a useable form and then take each of
the other components (open, high, low etc) and put them in the
appropriate variable type. Then once I have all of them I want to
be able to do certain mathmatically functions. To give a very
simple example I want to be able to work out the moving average
with the given data.
Please do not strip attribution lines for material you quote.
Those are the initial lines of the form "Joe wrote:", and give
credit to the authors.

Try this:

/* ------- file tknsplit.c ----------*/
#include "tknsplit.h"

/* copy over the next tkn from an input string, after
skipping leading blanks (or other whitespace?). The
tkn is terminated by the first appearance of tknchar,
or by the end of the source string.

The caller must supply sufficient space in tkn to
receive any tkn, Otherwise tkns will be truncated.

Returns: a pointer past the terminating tknchar.

This will happily return an infinity of empty tkns if
called with src pointing to the end of a string. Tokens
will never include a copy of tknchar.

A better name would be "strtkn", except that is reserved
for the system namespace. Change to that at your risk.

released to Public Domain, by C.B. Falconer.
Published 2006-02-20. Attribution appreciated.
Revised 2006-06-13 2007-05-26 (name)
*/

const char *tknsplit(const char *src, /* Source of tkns */
char tknchar, /* tkn delimiting char */
char *tkn, /* receiver of parsed tkn */
size_t lgh) /* length tkn can receive */
/* not including final '\0' */
{
if (src) {
while (' ' == *src) src++;

while (*src && (tknchar != *src)) {
if (lgh) {
*tkn++ = *src;
--lgh;
}
src++;
}
if (*src && (tknchar == *src)) src++;
}
*tkn = '\0';
return src;
} /* tknsplit */

#ifdef TESTING
#include <stdio.h>

#define ABRsize 6 /* length of acceptable tkn abbreviations */

/* ---------------- */

static void showtkn(int i, char *tok)
{
putchar(i + '1'); putchar(':');
puts(tok);
} /* showtkn */

/* ---------------- */

int main(void)
{
char teststring[] = "This is a test, ,, abbrev, more";

const char *t, *s = teststring;
int i;
char tkn[ABRsize + 1];

puts(teststring);
t = s;
for (i = 0; i < 4; i++) {
t = tknsplit(t, ',', tkn, ABRsize);
showtkn(i, tkn);
}

puts("\nHow to detect 'no more tkns' while truncating");
t = s; i = 0;
while (*t) {
t = tknsplit(t, ',', tkn, 3);
showtkn(i, tkn);
i++;
}

puts("\nUsing blanks as tkn delimiters");
t = s; i = 0;
while (*t) {
t = tknsplit(t, ' ', tkn, ABRsize);
showtkn(i, tkn);
i++;
}
return 0;
} /* main */

#endif
/* ------- end file tknsplit.c ----------*/

--
[mail]: Chuck F (cbfalconer at maineline dot net)
[page]: <http://cbfalconer.home.att.net>
Try the download section.

Jul 7 '08 #6
Cromulent <cr*******@justextrememetal.comwrites:
On 2008-07-07 00:06:09 +0100, Joe Wright <jo********@comcast.netsaid:
>>
>>>
Ah, I see. Yes that is exactly the type of data I will be
using. Here is an example:

Date,Open,High,Low,Close,Volume
3-Jul-08,0.80,1.09,0.80,1.09,77800
2-Jul-08,1.08,1.09,0.56,0.94,19600
1-Jul-08,1.09,1.09,0.95,1.08,29700
30-Jun-08,0.80,1.09,0.75,1.09,11500

Ok, thanks. I deal with these .csv files every day at my job. I
haven't used strtok() in twenty years, since I figured out how it
works.

Given your example file, what do you want to do with the data?

Basically I want to split the component parts up.
You could do a lot worse than simply using fscanf. If you make the
format quite strict and test the return you will be alerted to most
input errors:

char month[4], nl;
double open, hi, lo, close;
unsigned day, year, vol;
...
if (fscanf("%2u-%3s-%2u,%lf,%lf,%lf,%lf,%u%c",
&day, month, &year, &open, &hi, &lo, &close, &vol, &nl) == 9
&& nl == '\n')

--
Ben.
Jul 7 '08 #7
Bill Reid said:
>
Bill Reid <ho********@happyhealthy.netwrote in message
news:97********************@bgtnsc05-news.ops.worldnet.att.net...

DAMN!!! I hate it when that happens!!!
It would happen less if you listened more.

There are plenty of bright people in here.

You can always tell the bright ones, because they are the ones who learn
from other people's crits.

And then there are those who, like Bill, take criticism as insult and
respond to it with invective.

Not so bright.

Okay, Bill, flame away. Shouting is what you're good at, so you get on with
your shouting and let the poor newbie get on with learning C from people
who know it.

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
Jul 8 '08 #8
Richard Heathfield wrote:
Bill Reid said:
>Bill Reid <ho********@happyhealthy.netwrote in message
news:97********************@bgtnsc05-news.ops.worldnet.att.net...

DAMN!!! I hate it when that happens!!!

It would happen less if you listened more.

There are plenty of bright people in here.

You can always tell the bright ones, because they are the ones who learn
from other people's crits.

And then there are those who, like Bill, take criticism as insult and
respond to it with invective.

Not so bright.

Okay, Bill, flame away. Shouting is what you're good at, so you get on with
your shouting and let the poor newbie get on with learning C from people
who know it.
Yes, for instance mr heathfield that can't figure out that pointers
aren't always 32 bits...

See "C unleashed"

--
jacob navia
jacob at jacob point remcomp point fr
logiciels/informatique
http://www.cs.virginia.edu/~lcc-win32
Jul 8 '08 #9
On Tue, 08 Jul 2008 09:36:46 +0200, jacob navia posted:
Richard Heathfield wrote:
>Bill Reid said:
>>Bill Reid <ho********@happyhealthy.netwrote in message
news:97********************@bgtnsc05-news.ops.worldnet.att.net...

DAMN!!! I hate it when that happens!!!

It would happen less if you listened more.

There are plenty of bright people in here.

You can always tell the bright ones, because they are the ones who learn
from other people's crits.

And then there are those who, like Bill, take criticism as insult and
respond to it with invective.

Not so bright.

Okay, Bill, flame away. Shouting is what you're good at, so you get on with
your shouting and let the poor newbie get on with learning C from people
who know it.

Yes, for instance mr heathfield that can't figure out that pointers
aren't always 32 bits...

See "C unleashed"
I couldn't find the guarantee of 32-bit pointers. I don't think it's any
big secret that there were a lot of errors. My favorite of the whoppers is
Jack Klein's visualization of an error-correcting Hamming code announced as
(12,4) instead of (12,8), which completely reverses the role of the parity
and data bits.
--
I hate all sports as rabidly as a person who likes sports hates common
sense.
H. L. Mencken
Jul 8 '08 #10
Ron Ford said:
On Tue, 08 Jul 2008 09:36:46 +0200, jacob navia posted:
<snip>
>>
Yes, for instance mr heathfield that can't figure out that pointers
aren't always 32 bits...
(Mr Heathfield's first encounter with C pointers was in MS-DOS, in which
pointers are 20 bits, and there are various 16- and 32-bit bodges
available to deal with this weirdity - and Mr Heathfield has also worked
on systems with other pointer sizes, so Mr Heathfield is well aware that
pointer size is not written in stone. Perhaps Mr Navia would be so kind as
to point out where CU claims that pointers are always 32 bits?)
>>
See "C unleashed"
Which bit?
I couldn't find the guarantee of 32-bit pointers. I don't think it's any
big secret that there were a lot of errors.
No, it's no secret. We've documented as many as we can find. It would be
nice to have the chance to go back and have another crack at it, fix all
this stuff, but unfortunately that isn't going to happen, but we've done
what we can.

This is an illustration of my earlier point - that the bright response to
bug reports is to investigate the reports and, in cases where the reports
are correct, to put them right if possible, or at least to record them,
publish them, and learn from them. NOT to yell at the guy who made the
crit. There are several people in comp.lang.c who have yet to learn this.

<snip>

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
Jul 8 '08 #11
Richard Heathfield wrote:

Perhaps Mr Navia would be so kind as
to point out where CU claims that pointers are always 32 bits?)
Specifically in Chapter 11, page 353 you assume
sizeof pointer is equal to sizeof int...

It will work when sizeof pointer is equal to sizeof int
(windows or linux 32 bit versions) but will crash when
sizeof int != sizeof pointer (windows 64 bits.

I would never mind that you have a bug. What bothers me
is how you make fun of other people when they try to
write something and have a bug!

This slightly ironic tone, this "dettached" viewpoint,
as you never make those kind of errors.
--
jacob navia
jacob at jacob point remcomp point fr
logiciels/informatique
http://www.cs.virginia.edu/~lcc-win32
Jul 8 '08 #12
jacob navia said:
Richard Heathfield wrote:

Perhaps Mr Navia would be so kind as
>to point out where CU claims that pointers are always 32 bits?)

Specifically in Chapter 11, page 353 you assume
sizeof pointer is equal to sizeof int...
I don't see it. I *do* see where I assume that sizeof(int **) is equivalent
to sizeof(int *), which is itself a bug - one that was first reported (by
Chris Mears) and published (almost) EIGHT YEARS AGO - but a far cry from
assuming that pointers are always 32 bits. I can't see the number 32
anywhere on that page.

I think the simplest explanation of your claim is that you have made two
errors here: 1) you have assumed that ints are always 32 bits; 2) you have
misread my code as if it assumed that sizeof pointer is equal to sizeof
int. Given those errors, it is easy to see why you might think I'd claimed
pointers are 32 bits. But those are your mistakes, not mine.

You made an incorrect claim, or at least a claim that you have not
substantiated - that CU claims pointers are always 32 bits. Your attempted
substantiation, Ch 11 p353, modified the claim itself, and the modified
claim was also incorrect. And the bug that /is/ there was documented on
the errata page in November 2000.

It will work when sizeof pointer is equal to sizeof int
(windows or linux 32 bit versions) but will crash when
sizeof int != sizeof pointer (windows 64 bits.

I would never mind that you have a bug. What bothers me
is how you make fun of other people when they try to
write something and have a bug!
I don't make fun of people for making mistakes. I do sometimes make fun of
people for refusing to learn from them.
This slightly ironic tone, this "dettached" viewpoint,
I save the ironic tone for special occasions, which are fewer than they
used to be, now that the Terrible Triplets are safely behind plonkbars.
The detached viewpoint is one that you would do well to cultivate. It
might well bring your blood pressure down.
as you never make those kind of errors.
Everybody makes mistakes. The question is not whether we are perfect, but
whether we are striving to become perfect. Those who are trying to become
better programmers will react to criticisms of their code in a positive
way.

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
Jul 8 '08 #13
Richard Heathfield wrote:
jacob navia said:
>Richard Heathfield wrote:

Perhaps Mr Navia would be so kind as
>>to point out where CU claims that pointers are always 32 bits?)
Specifically in Chapter 11, page 353 you assume
sizeof pointer is equal to sizeof int...
[snip]
And the bug that /is/ there was documented on
the errata page in November 2000.

Right.

So please stop making fun of people when they have a bug.

And here in this same group I have pointed several bugs in code
you posted, so just be kind with others when they have a bug.
--
jacob navia
jacob at jacob point remcomp point fr
logiciels/informatique
http://www.cs.virginia.edu/~lcc-win32
Jul 8 '08 #14
jacob navia <ja***@nospam.comwrites:
Richard Heathfield wrote:

Perhaps Mr Navia would be so kind as
>to point out where CU claims that pointers are always 32 bits?)

Specifically in Chapter 11, page 353 you assume
sizeof pointer is equal to sizeof int...

It will work when sizeof pointer is equal to sizeof int
(windows or linux 32 bit versions) but will crash when
sizeof int != sizeof pointer (windows 64 bits.

I would never mind that you have a bug. What bothers me
is how you make fun of other people when they try to
write something and have a bug!

This slightly ironic tone, this "dettached" viewpoint,
as you never make those kind of errors.
I would never mind that *you* have a bug. What bothers me is when you
treat bug reports as personal attacks. I have never seen Richard do
this; I see you do it over and over again.

And you don't seem to understand the difference.

--
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"
Jul 8 '08 #15
On 2008-07-07 23:52:53 +0100, "Bill Reid" <ho********@happyhealthy.netsaid:
<snip - a very useful post>
Thank you for that, it was incredibly useful. I'll have to spend a
little time digesting that tomorrow evening, I didn't expect anything
of that magnitude.

Also thanks for the other pointers in this thread, I'll get the hang of
this some day :).
--
"I disapprove of what you say, but I'll defend to the death your right
to say it." - Voltaire

Jul 8 '08 #16

Richard Heathfield <rj*@see.sig.invalidwrote in message
news:B5******************************@bt.com...
Bill Reid <ho********@happyhealthy.netwrote in message
news:97********************@bgtnsc05-news.ops.worldnet.att.net...

DAMN!!! I hate it when that happens!!!

It would happen less if you listened more.
????

I wouldn't make mistakes if I "listened more"? Really good
"listeners" rarely or never make mistakes?

If that's your "logic", I don't agree, and have to conclude that
"troll zero" is getting ever-more irrational in his dotage...
There are plenty of bright people in here.

You can always tell the bright ones, because they are the ones who learn
from other people's crits.

And then there are those who, like Bill, take criticism as insult and
respond to it with invective.

Not so bright.

Okay, Bill, flame away. Shouting is what you're good at, so you get on
with
your shouting and let the poor newbie get on with learning C from people
who know it.
You know, right in the code I "corrected" there was ANOTHER
error. DOUBLE-DAMN!!!

But instead of pointing out any of the several actual errors in what
I posted in a legitimate and knowledgeable attempt to help the guy,
you chose to merely indulge in content-less and misleading personal
attacks.

Which is why you'll always be "troll zero" 'round these parts...

---
William Ernest Reid

Jul 8 '08 #17
Bill Reid said:
>
Richard Heathfield <rj*@see.sig.invalidwrote in message
news:B5******************************@bt.com...
Bill Reid <ho********@happyhealthy.netwrote in message
news:97********************@bgtnsc05-news.ops.worldnet.att.net...

DAMN!!! I hate it when that happens!!!

It would happen less if you listened more.

????

I wouldn't make mistakes if I "listened more"?
No, that's not what I said. I said you'd make *fewer* mistakes if you
listened more.
Really good "listeners" rarely or never make mistakes?
That's not what I said either.
If that's your "logic", I don't agree,
And if Keith Thompson's computer is a bicycle, I play the violin. So what?
But instead of pointing out any of the several actual errors in what
I posted
I've done that several times before, and just got yelled at for my pains.
So have several other people here who've tried to help you. If only you'd
listened more to these folks, you'd have made fewer mistakes.

If you want me to help you out by pointing out your mistakes, you need to
convince me that it has become worthwhile to help you - that you are
capable of learning from such help, and able to receive it in a civilised
manner. And if you want to convince me of that, you're not making your
task any easier by hurling abuse.

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
Jul 8 '08 #18

Richard Heathfield <rj*@see.sig.invalidwrote in message
news:5_******************************@bt.com...
Bill Reid said:
Richard Heathfield <rj*@see.sig.invalidwrote in message
news:B5******************************@bt.com...
Bill Reid <ho********@happyhealthy.netwrote in message
news:97********************@bgtnsc05-news.ops.worldnet.att.net...

DAMN!!! I hate it when that happens!!!

It would happen less if you listened more.
????

I wouldn't make mistakes if I "listened more"?

No, that's not what I said. I said you'd make *fewer* mistakes if you
listened more.
OK, logically you're just making a distinction between the
"reducto ad absurdum" and the fact that your assertion is
merely absurd: irrational, unprovable, and totally unsupported
by evidence...
Really good "listeners" rarely or never make mistakes?

That's not what I said either.
OK, in this case you are disclaiming a logical conclusion that
doesn't rely totally on the "reducto", but IS a fully "truth-positive"
conclusion based on your absurd assertion, and so you are
probably disingenuously attempting to disclaim any rationatination
of your absurdity based only on the juvenile defense of precise
wording.
If that's your "logic", I don't agree,

And if Keith Thompson's computer is a bicycle, I play the violin. So what?
Exactly. You made an absurd statement, which can't sustain
even the slightest logical scrutiny. Your ACTUAL position is that
since you are angry, I make mistakes. Of course, the number
of mistakes I make has little to nothing to do with your anger.

I WOULD accept the assertion that the number of mistakes you
POINT OUT is directly related to YOUR anger, which probably is
the result of some over-arching life frustation. Perhaps this is what
you REALLY meant to say...or what you could never admit...
But instead of pointing out any of the several actual errors in what
I posted

I've done that several times before, and just got yelled at for my pains.
I don't remember anybody ever mistreating you for pointing out a
true mistake, and I certainly never have...
So have several other people here who've tried to help you. If only you'd
listened more to these folks, you'd have made fewer mistakes.
Ridiculous. Of course, now you've slipped right into drawing conclusions
based on your absurd unsupported assertion, but when I do the same, you
hypocritically disclaim it by saying, "that's not what I said."

But you can't wiggle out of the above idiotic statement using that
piece of juvenile argumentation. My mistake was using the wrong
format specifier for scanf(), and I would have made it inadvertantly
regardless of any "corrections" I did not "listen to" enough in the
past. I also misssspeel words inadvertantly, lose my car keys
(or I used to, now I've got a "system"), forget people's birthdays,
and make any number of other totally human errors, and NONE
of them has ANYTHING to do with the amount of "listening" I do.
If you want me to help you out by pointing out your mistakes, you need to
convince me that it has become worthwhile to help you - that you are
capable of learning from such help, and able to receive it in a civilised
manner.
Has anybody told you lately that you're a pompous jerk? Oh, yeah,
about 10 people just today...

Look, if you weren't SUCH a pompous jerk, you'd correct my mistakes
in the same way I corrected my own mistake, and for the same reason: to
genuinely try to avoid confusion. But as a die-hard pompous jerk, you
are too lazy or stupid to correct actual errors, and instead resort to
childish insults in between bouts of useless pedantry, and then
amazingly enough, seem to actually believe that I DESIRE your
input on ANYTHING.
And if you want to convince me of that, you're not making your
task any easier by hurling abuse.
I don't want to convince you of ANYTHING...as with all trolls, my only
hope is that you'll just tire of your trollery here and go away, but I
daren't
raise my "hope" to the level of a "goal" because I know it would be
Quioxtically impossible to attain...

---
William Ernest Reid

Jul 9 '08 #19
On Tue, 08 Jul 2008 09:12:12 +0000, Richard Heathfield posted:
jacob navia said:
>Richard Heathfield wrote:

Perhaps Mr Navia would be so kind as
>>to point out where CU claims that pointers are always 32 bits?)

Specifically in Chapter 11, page 353 you assume
sizeof pointer is equal to sizeof int...

I don't see it. I *do* see where I assume that sizeof(int **) is equivalent
to sizeof(int *), which is itself a bug - one that was first reported (by
Chris Mears) and published (almost) EIGHT YEARS AGO - but a far cry from
assuming that pointers are always 32 bits. I can't see the number 32
anywhere on that page.
I don't see it quite like you say it. You give three different methods for
resizing arrays. All three look significantly different. Is it one of
those assumptions that fouls the whole thing?

One other thing, I was poking around n1256.pdf to find out what guarantees
there are on the width of an int. I found:

A ¡¥¡¥plain¡¦¡¦ int object has the natural size suggested by the
architecture of the execution environment (large enough to contain any
value in the range
INT_MIN to INT_MAX as defined in the header <limits.h>).

and

¡Xminimum value for an object of type int
INT_MIN -32767 // -(2 15
- 1)
¡Xmaximum value for an object of type int
INT_MAX +32767 // 2 15
- 1

Are there circumstances in which a C int object is 47 bits?
--
The only really happy folk are married women and single men.
H. L. Mencken
Jul 9 '08 #20
On Jul 8, 1:32*am, jacob navia <ja...@nospam.comwrote:
Richard Heathfield wrote:

Perhaps Mr Navia would be so kind as
to point out where CU claims that pointers are always 32 bits?)

Specifically in Chapter 11, page 353 you assume
sizeof pointer is equal to sizeof int...
I have the book open there to that page and cannot find that
assumption either implicitly or explicitly. Could you be so kind as
to point it out exactly? I am not doubting the existance, I am only
unable to locate it.
It will work when sizeof pointer is equal to sizeof int
* (windows or linux 32 bit versions) but will crash when
* sizeof int != sizeof pointer (windows 64 bits.

I would never mind that you have a bug. What bothers me
is how you make fun of other people when they try to
write something and have a bug!
Are you suggesting that you do not make fun of (or otherwise deride)
other people who post here?
This slightly ironic tone, this "dettached" viewpoint,
as you never make those kind of errors.
Richard is remarkably mistake free, as far as I can tell. Maybe
Lawrence Kirby, Dan Pop or Tanmoy Bhattacharya produce less defects
per post on average but I guess Richard is in the top 0.1% of c.l.c
posters as far as correctness is concerned. That having been said, I
have found that Richard is also remarkably forthright about admitting
to a mistake on the rare occasions when it does occur.

According to:
http://www.informit.com/articles/art...69222&seqNum=9
"A typical software development project injects approximately 100–250
defects per thousand lines of code [Humphrey 02]."

Not a very comforting thought. Hence the drive for correctness common
to news:comp.lang.c should be viewed as laudable (IMO-YMMV)
Jul 9 '08 #21
On Jul 8, 2:18*am, jacob navia <ja...@nospam.comwrote:
Richard Heathfield wrote:
jacob navia said:
Richard Heathfield wrote:
Perhaps Mr Navia would be so kind as
to point out where CU claims that pointers are always 32 bits?)
Specifically in Chapter 11, page 353 you assume
sizeof pointer is equal to sizeof int...

[snip]
* And the bug that /is/ there was documented onthe errata page in November 2000.

Right.

So please stop making fun of people when they have a bug.

And here in this same group I have pointed several bugs in code
you posted, so just be kind with others when they have a bug.
Even Donald Knuth makes mistakes. If Donald Knuth can make a mistake,
then everyone can (and will) make them.

You do have a valuable suggestion here (paraphrasing from "Bill and
Ted's Excellent Adventure"):
Bill: "Be excellent to each other."

Truthfully, if we could all have the sensitivity of Tanmoy B., then
news:comp.lang.c would be a better place.

On the other hand, having some sort of lurid blood in my veins, I will
admit that I thoroughly enjoyed seeing Dan Pop fry recalcitrant
posters from time to time. I'm working on that.
Jul 9 '08 #22
Bill Reid said:
Richard Heathfield <rj*@see.sig.invalidwrote in message
news:5_******************************@bt.com...
>Bill Reid said:
<snip>
>
I wouldn't make mistakes if I "listened more"?

No, that's not what I said. I said you'd make *fewer* mistakes if you
listened more.

OK, logically you're just making a distinction between the
"reducto ad absurdum" and the fact that your assertion is
merely absurd:
No, I was just trying to show you how you could make fewer mistakes. How
stupid of me to even consider trying to help you.

<lots of nonsense snipped>

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
Jul 9 '08 #23
Ron Ford said:
On Tue, 08 Jul 2008 09:12:12 +0000, Richard Heathfield posted:
>jacob navia said:
>>Richard Heathfield wrote:

Perhaps Mr Navia would be so kind as
to point out where CU claims that pointers are always 32 bits?)

Specifically in Chapter 11, page 353 you assume
sizeof pointer is equal to sizeof int...

I don't see it. I *do* see where I assume that sizeof(int **) is
equivalent to sizeof(int *), which is itself a bug - one that was first
reported (by Chris Mears) and published (almost) EIGHT YEARS AGO - but a
far cry from assuming that pointers are always 32 bits. I can't see the
number 32 anywhere on that page.

I don't see it quite like you say it. You give three different methods
for
resizing arrays.
For providing resizeable two-dimensional arrays.
All three look significantly different. Is it one of
those assumptions that fouls the whole thing?
The assumption that T* and T** have the same width is not a good one. It
affects only the second method of the three. (To save you looking for it,
I don't actually show source for the first method.) The failing is with
the code on pp353-356top. In practice, it'll work fine, because in
practice, T* normally does have the same size and alignment requirements
as T** - but in theory there could exist a platform on which it would
fail.
One other thing, I was poking around n1256.pdf to find out what
guarantees
there are on the width of an int.
It's at least 16 bits wide, but can be wider.

<snip>
Are there circumstances in which a C int object is 47 bits?
The rules don't forbid it.

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
Jul 9 '08 #24
On 8 Jul 2008 at 23:51, Richard Heathfield wrote:
If you want me to help you out by pointing out your mistakes, you need to
convince me that it has become worthwhile to help you - that you are
capable of learning from such help, and able to receive it in a civilised
manner. And if you want to convince me of that, you're not making your
task any easier by hurling abuse.
It's abundantly clear from this one paragraph that there's absolutely no
danger of Bill losing out on any "help" from you - but if he's lucky you
might killfile him and then he'll miss out on a load of patronizing
garbage dispensed from on high.

Jul 9 '08 #25
In article <sl*******************@nospam.invalid>,
Antoninus Twink <no****@nospam.invalidwrote:
>On 8 Jul 2008 at 23:51, Richard Heathfield wrote:
>If you want me to help you out by pointing out your mistakes, you need to
convince me that it has become worthwhile to help you - that you are
capable of learning from such help, and able to receive it in a civilised
manner. And if you want to convince me of that, you're not making your
task any easier by hurling abuse.

It's abundantly clear from this one paragraph that there's absolutely no
danger of Bill losing out on any "help" from you - but if he's lucky you
might killfile him and then he'll miss out on a load of patronizing
garbage dispensed from on high.
Patronizing garbage is as good as it gets around here.

You oughta know that by now.

Jul 9 '08 #26

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

8 posts views Thread by watkinsdev | last post: by
reply views Thread by shapper | last post: by
16 posts views Thread by SirG | last post: by
10 posts views Thread by DavidSeck.com | last post: by
reply views Thread by devrayhaan | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.