spinoza1111wrote:
Humm... I may me misunderstanding you, buy exactly why do the objects need
to be stored elsewhere?
If they don't, where does the pointer point?
I mean, the list already stores a reference to the
object and that's good enough for me. For instance, where am I using extra
storage to "store objects" in the following program:
"Extra" meaning "in addition to the list objects".
In:
struct foo {
struct foo *next;
char data[];
};
(C99), each allocated "struct foo" contains the associated data.
No, it doesn't. Furthermore, you are representing the problem as one
of character data only as if that were the only type of linked list.
Um, that's nonsense. What he's doing is explaining to Chris the
difference between containing and indexing in terms of storage, and he's
trying to do so in a way that even you can understand. Clearly, he's
failing at that last bit, but that's hardly surprising. His char example
is just that - an example.
He won't let Schildt use similar examples where a concrete example has
features that aren't true of the general case. I won't let him. If he
had credibility, I would. It's that simple.
In this example, as in your second example below, an address is in the
node!
The two methods are equivalent. char a[] == char *a functionally and
conceptually.
Rubbish. The first one is a "struct hack" - IMHO ugly, but pragmatic in
C90 and codified (with slightly different syntax, reflected above) in
C99. Usage is as follows:
struct foo *new = malloc(sizeof *new + number_of_extra_bytes_needed);
if(new != NULL)
{
new->next = NULL;
strcpy(new->data, data);
}
You would do better to learn from Seebs than to presume to teach him.
Not in a million years.
You have nothing to teach but expletives, and I expect he knows those
already.
No, I don't think he does. And as far as I'm fucking concerned,
asshole, the time for a good, solid motherfucking expletive est
arrive, since ten fucking years of trying to make you behave with
common decency have not changed your **** character. Using expletives
is a VICTIMLESS action, whereas your constant attacks on reputations
and good names here, based on a series of temp jobs and a pathetic
book, has damaged people and wasted our time.
struct a { char arr[1]; };
That isn't what he wrote.
struct b { char* ptr; } bb;
printf("%d %d\n", sizeof(bb), sizeof(bb));
Prints 4 4 no matter what size arr is or even if the array size is
removed.
So you're saying that, on systems with 4-byte pointers, if you print out
the size of a structure containing nothing but a pointer, twice, it'll
print out 4, twice? Gee whizz! (Hint: you printed the same size twice.)
I noticed the error 60 seconds after posting and removed the post. I
believe I also posted a followup. Whereas you and Seebach need
consistently to have your errors explained to you, in some cases
repeatedly.
Now, please put down your non sequitur and step away from your reply
button, and pop over to a Web browser. Look up "struct hack". You'll
find a zillion hits for it. Read, mark, learn, and inwardly digest. And
it won't be long before you're trying to pretend that you knew about it
all along.
To "hack", alack, is not what to the wise and grave aspire
It means to get "results" in a mode fit only for the fire
It's a job for apes and monkeys, low creatures in greed for gold
It is Stygian, it is Augean, it is for creatures dank and cold.
My code is so unusual because it is in fact well wrought
To deliberately "hack" might seem real cute but it delivers aught:
But what the cunting **** do you care, the client pays his bill
And before the bugs and low performance start, you disappear over
Whoredom's hill.
No, let us NOT now cue an "expletive",
Let's cue instead pentameter iambic:
For indeed, your villainy, while it hath not
Dimension tragic, hath had tragic issue.
A monster from the depths of contract code
Thinking himself a man, dons man's attire
To curse him for a fool it is not enow
To make others, not he, see the tragic result.
He is blind, he howls upon the heath,
His is the soul of much less than a Flea,
He is deaf to reason in any season,
Trogdolyte homunculus and Frankenstein
Who's set his face on all that is fine.
So the low sew their ignorant bile
And so the wise weep, and no longer smile.
We have gotten too and now we're through
With applying to you, words like fuckhead, whore and ****:
We leave you bone-strewn in your cave, and fairer fields, we hunt.
struct a { char arr[1000]; };
struct b { char* ptr; } bb;
printf("%d %d\n", sizeof(bb), sizeof(bb));
You're still printing the same size twice.
Jerk. This error was found and corrected, and the post deleted. It
took me ten seconds to find it. How long did it take you?
A Monster thinks that he's a man
And howls his lies to all who'll hear
Finds fool's gold and seizes it,
Gibbers and capers in apish triumph.
Defeated in the eyes of the only wise,
Who are, in fact, those who only wise would someday be,
He quests about in search of foul fetid fiends
To follow him festering in his fennish den,
And there recount with a fearfilled snigger
Tales of those wights who would be men
Tales of those who sought the truth,
Tales of those whom they hate so much
For they can never hear nor see
Glory in their misery.
Very true, your error is much more egregious. Did you really think you
could make a 1000-byte array only four bytes big?
No.
We all know that software and software talk is error prone. However,
you and Seebach, owing to the fact that you're both incompetent, have
treated the errors of others without charity and are now being subject
to the same treatment, only by someone who's far more qualified...so
much so that because data processing is a cost center, there's really
no need for that wight to waste his spirit on such an expanse of
shame, talking with the clue challenged, halt and lame.
You did indeed add that error. But Seebs didn't.
Rubbish. Proof by reductio: You just started a sentence with "This".
Spare me the pompous Latin. You're not qualified to use it.
Therefore, apparently you think all sentences must start with "This".
How ridiculous is that?
Gee, when all else fails, change the subject: either retail some war
story about someone who you think was even more incompetent and a
weakling that you think you are, or reduce random shit to absurdity,
which demonstrates nothing.
> to a growing collection of serious newbie
You don't know what you're talking about, and it shines out from every word.
Your criticism is misplaced. He's not showing you how to use a
type-blind list. That's already been done, in the source text under
discussion. Rather, he's showing you (or rather, Chris) the difference
between containing and indexing.
By his logic, that he applied in "C: the Complete Nonsense", we can
infer that he thinks that all linked lists must be char. Frankly, I
don't think he's that much a fool, and I made this clear. I merely
pointed out that he made the same gesture as Schildt, but expects to
be forgiven.
This demonstrates my points. Like most creeps, he's been, probably,
overmothered to believe that he's "special", and thus may apply
different standards to others that he applies to himself. He can use
char in a linked list, which MAY be interpreted by the newbie, reading
random posts, as implying that "all linked lists must be char", but
Herb could not say that the heap is in high memory by way of
illustration (as does the high school geometry teacher draw ONE
triangle) without Seebach getting his panty hose in a tangle.
In fact, just as a careful writer would have written, had he believed
that Herb's clarity hides error, that "Herb is only apparently clear",
a careful writer/coder would have either used pointer to void in the
example, or else annotated it to the effect that char was only an
example. However, because Seebie failed to learn to write in skewl,
such complexity strikes him as precisely that kind of quirkiness that
would have by his own rule, marginalized him.
"Normalized deviance" means that Seebach, when he wrote the silly %s
solution, didn't dare even try to do the job right, using strstr
instead of strchr. He literally is afraid to think, and do a good job,
and this is why he so hates people who make the effort, and laughs at
them when they make mistakes: it's because he sees the secret contour
of his own weakness.