Implementing strstr

B

blmblm

[ snip ]
Search me.

Didn't you say above that it did?
In the context such a tool is intended to be used, you
don't use C. Instead, you use a scripting language with builtin string
handling such as Rexx for the IBM mainframe, Visual Basic .Net or
Visual Basic for Applications on Microsoft platforms, or awk or its
descendants on Linux and unix. The code was completely useless to
anyone here as opposed to the instructional utility of demonstrating
how to learn string handling from people like Willem and Ben (and me)
by discarding string.h. It was a vanity effort which I think Peter
meant to show that he was qualified to code C. As such, he
demonstrated to me that he's far less qualified than he thinks he is,
and far less qualified than Heathfield, who has a good grasp of the
trees but sometimes gets lost in the forest. This has been confirmed
in recent weeks by each code snippet and program he has posted.

But...he would merit my silent pity, and I would make no comment, save
for the Schildt canard, and his treatment, last January, of my
collegial request for an exchange of email about Schildt. As you will
recall, he discarded my email unread and proceeded to repeatedly call
me (a fellow Apress author) "insane", a "moron", and a "kook". I am
none of these things.

Quoted on the off chance that Seebs feels inclined to remind(?) us *why*
this e-mail was deleted unread.
The worst type of bug is one that doesn't "actually fail", most of the
time, or even never, when, years later, a maintenance programmer makes
a small change (such as adding %t as a different type of pattern, and
not expecting it to be changed), only to have the new code fail.
Professional programmers produce, as I produce, tokens of a type or
set of alternative texts which meet a range of neighboring
possibilities in such a way that it's easy to change from one token to
the next.

[Peter claims to have fixed the %s/%t confusion but his fix did not
address the ontological heart of the matter: that %s and %t are
strings, and IF you include string.h, THEN you need to use strstr.]

This sounds like the ravings of a "crazy man" who caught schizophrenia
from Nash only to uneducated paraprogrammers, whether the truly
unwashed, or people who "washed" out of other fields and came, filled
with self-hatred, shame and anger, to programming. But the fact is
that like a number of older programmers (such as Richard Stallman), I
spent a number of summers yearning for a CPU and drycoding programs,
along with learning mathematics, logic and the foundations of
mathematics. I also studied theater and literature in that time so
that by the time I was a graduate student in CS, I'd learned that
people and ideas matter far more than machines and software.

I'm afraid that Peter never had this chance, nor the chance to solve
difficult problems on his own, but not on his own terms. He was
sitting in a university, presumably with Mommy and Daddy paying his
tuition, unlike my middle class black and female students at DeVry,
who staggered in exhausted from working two jobs to pay their
tuition.

If he was interested in computers, it seems reasonable that he would
have taken a class; I jumped at the chance, in 1970, to take the first
class in computer science at Roosevelt University in Chicago.

We all get 168 hours per week, but we make different choices
about what to do with them. Didn't you say that at some point
stop taking classes because you had other obligations? What is
that but a choice .... said:
I can
only conclude that he's developed a passive-aggressive style which is
better treated by traditional psychiatry and outdoor service work than
medication...but would caution you, saying that that diagnosis is
probably irresponsible, possibly as irresponsible as people who
diagnose me as schizo because they can't read worth dick.

[ snip ]
 
S

Seebs

Do we even have evidence that he 'worked with' John Nash.

Interesting question. I have generally assumed that he does not
intentionally lie, but I am obliged to grant that his ability to get
facts right is pretty dismal, and he doesn't seem to adapt his claims
in response to corrections. This suggests that he's got a lot of
cognitive filtering going on to make his memories more acceptable
to him.

-s
 
S

Seebs

Uh, no. I define it because I understand symbolic constants. :)
Now this, I think, is a fair cop. Seebs, is this another case of
not getting the easy stuff right? though really, it's kind of hard
for me to imagine ....

Ayup.

Keep in mind, I once had a firecracker go off in my hand because I
*forgot I was holding it*.

This is the kind of thing I catch if I make a pass through the code after
writing it. (Ben actually caught a more substantial bug, which I've also
fixed.) I also tend to do things like waffling between two plausible names
for a variable, but at least compilers catch that.

Note that the only bug Nilges found was in the hastily-cobbled-together
test harness, it didn't actually change the behavior of anything, he
misunderstood why I was using defined-length buffers, and that the actual
algorithm appears to have had only one bug (that we've found so far,
anyway) which could be fixed in under 5 minutes. I maintain that trivial
errors that can be corrected immediately are a lot less of a problem than
the sorts of epically-unmaintainable garbage he produces.
Did it actually fail, in the context in which it was intended to be
used?

No. Since I controlled the inputs, it worked exactly as expected; the
use of '%s' was purely documentary for the user.

This one's just a plain error.

Also untrue, so far as I know -- assuming he's talking about the db_header
thing.

-s
 
S

Seebs

Didn't you say above that it did?

He did. And it didn't.

Actually, no. In the context that tool was intended to be used, it would
be called hundreds of thousands of times in a time-critical hunk of stuff,
such that the cost of starting up a script interpreter would be prohibitive.
Quoted on the off chance that Seebs feels inclined to remind(?) us *why*
this e-mail was deleted unread.

Because Nilges is a kook. He's unreliable in comprehending simple English,
he writes long and unrelated rants, he frequently refuses to answer simple,
direct, and topical questions, and his obsession with the issue has nothing
to do with me, so far as I can tell.

When he first posted about this in clcm, I responded and asked a number of
relevant, technical, questions. They went largely ignored because he has no
answers to them. He's not worth arguing with, except in that he sometimes
says something technically wrong in a way that newbies could learn from seeing
a correction to.
[Peter claims to have fixed the %s/%t confusion but his fix did not
address the ontological heart of the matter: that %s and %t are
strings, and IF you include string.h, THEN you need to use strstr.]

This, too, is untrue, but it's also worth pointing out that the '%s' thing
(there was no "%t", ever) was, in fact, "fixed" by switching to strtstr.
We all get 168 hours per week, but we make different choices
about what to do with them.

Yup.

Speaking of which, I'm going to go use my advanced education and theoretical
background to go help a friend unload shingles from a truck.

-s
 
S

Seebs

Um, not to spoil your fun, but as best I can tell the limitation applies
only to the test harness, not to the actual my_strstr function.

And indeed, the comments address this specifically.

(I have no idea what he thinks this means.)
Since the above code is part of the *test harness*, how does it affect
the performance of my_strstr?

The "waste" is there because I like to use that for string test harnesses;
it gives me pointers that I can compare to each other, and allows me to
stash magic values to check for overruns.

And yes, as you note -- none of this is in the my_strstr implementation.
The test harness is indeed inefficient and specialized; it's there just
to let me check my work.

-s
 
S

spinoza1111

Uh, no.  I define it because I understand symbolic constants.  :)

Using the rule you uncharitably use on others, including Schildt and
myself, we CAN infer from any one of your mistakes that you don't
understand the facility. I'm not sure I can make this inference in
this case, you may have SOME sort of superficial "knowledge" from
reading books and your foolish friends. But you have proved, each and
every time you posted code, that you don't know how to apply this
knowledge, and your self-hatred, on which you based your attacks on
Schildt and myself, is evident in your lack of enough self-esteem not
to make a fool of yourself.

Your mistake in using and then not using a symbolic constant is
consistent, and a professional programmer would not make it even in a
first draft. And you took TWO MONTHS to come up with that crap.
Ayup.

Keep in mind, I once had a firecracker go off in my hand because I
*forgot I was holding it*.

I would suggest you address that problem, especially before you barge
in here calling people "insane" or "morons" or "kooks", because you're
asking for a charity you do not extend to others.
This is the kind of thing I catch if I make a pass through the code after
writing it.  (Ben actually caught a more substantial bug, which I've also

I suggest in future you make several passes before you waste our time.
If you were a real programmer, you'd take some pride in your work
instead of attacking real programmers like Schildt or telling people
who've TAUGHT computer science that problems are beneath you as "first
year CS"...when you haven't taken first or any year CS.
fixed.) I also tend to do things like waffling between two plausible names
for a variable, but at least compilers catch that.

Note that the only bug Nilges found was in the hastily-cobbled-together

....after about ten minutes of reading code I found horrid and
disgusting. I then had to go to work. You know about work, don't you.
It's not where you talk some company into letting you work when you
want 'cause you is white and middle class, and come here to get your
"homework" fixed.
test harness, it didn't actually change the behavior of anything, he
misunderstood why I was using defined-length buffers, and that the actual

No, I stopped there, and said, this guy is doing TOO MUCH unnecessary
copying. Like I said, I'm having fun and will find at this rate many
more problems, some of which have already been found by Ben.

If you think you've invented a clever new algorithm for strstr...well,
aux d'autres, ma vielle. While I'm not through with your crap code,
and expect to find many new gems of idiocy, you don't copy bytes to do
a strstr.
algorithm appears to have had only one bug (that we've found so far,
anyway) which could be fixed in under 5 minutes.  I maintain that trivial
errors that can be corrected immediately are a lot less of a problem than
the sorts of epically-unmaintainable garbage he produces.

Long ago, I realized that English and computer science skills were in
fact so low in Corporate Amerikkka that good code could be
"unmaintainable", and I went on record as saying so at a talk at the
Data Processing Management Association in Peoria. The code is not
designed to be maintained by the likes of you, since I now realize
you're not competent.
No.  Since I controlled the inputs, it worked exactly as expected; the
use of '%s' was purely documentary for the user.

So you're the slob who wrote the horrible compiler at Motorola who
said that he didn't need to insert any error checks since the team
could be "disciplined" to submit "good" code?

Apply to Devry
I say with a sigh
Learn your trade
Lay off the Kool Ade
This one's just a plain error.

....on your part. Bohm and Jacopini PROVED that any program can be
written using only three control structures, process, if..then..else,
and do while, and the most important fact about the Bohm-Jacopini
structures is that they each have one entry and one exit. This means
that they can be plugged together in a comprehensible fashion and
gives a solid, mathematical basis to an intuitive notion of
"readability"...which happens to be completely at variance from your
childish and narcissistic notion of readability-as-something-Petey-can-
fucking-read.

Dijkstra observed that the best programmers in his experience followed
the Bohm-Jacopini model even before it was formally proven. I read FT
Baker's article on Dijkstra/Bohm/Jacopini in 1972 in the IBM Systems
Journal along with Dijkstra's letter as an assembler and Fortran
programmer, and immediately realized that in assembler and Fortran-II,
despite their absence of modern control structures at the level of
syntax, what really counted was a style that showed the isomorphism of
the code with a structured flowchart of the code, back in an era when
flowcharting was still in vogue.

I applied this to find that my productivity increased to the point
that I was able to write a complete grading solution for the Registrar
who labeled me upon completion a bloody genius, and several other
modules, all written in assembler but more testable and less prone to
failure than my pre-1972 code.

In 1976, I published my first computer article, on "Virtually
Structured Programming", in Computerworld.

Now, a "fallthrough switch()" block consists of one or more cases
which have more than one, precisely TWO entries: one when the switch
goes to the case (ack or nak in your odious code), and another where
control arrives from the case above. It is NOT a structured
programming constant.

However, many thoughtful programmers would object that I have to apply
a transformation from code like this pseudo-assembler, which is
isomorphic to a structured flowchart, to code in "true" structured
style:

if (c) goto L1
a; b; c;
L1:
L2:
if (c2) goto L3
d; e;
goto L2
L3:

Isn't the fact that Petey's miserable botched code easily enough
translated into a structured switch() (which is further transformable
to a series of nested ifs which is less readable in practice than a
switch that does not fallthrough) show that he too is structured?

No, because in the above at runtime, it is always known what small and
immediately comprehensible single entry/exit "block" you're in and
this simply makes reading and debugging by way of the same heuristic
great programmers used before Bohm and Jacopini proved their result.

Another test might possibly be failed, although at this point I've
proven that Peter doesn't know what he's doing if he dares claim his
switch() blocks are structured, since the test is more conservative.
It's the Dijkstra test:

"If 10 years from now, when you are doing something quick and dirty,
you suddenly visualize that I am looking over your shoulders and say
to yourself: 'Dijkstra would not have liked this', well that would be
enough immortality for me."

I don't think Dijkstra would have approved of staying as I stayed out
of economic necessity with non-structured languages like Fortran-II,
Cobol and assembler in the conservative Chicago computing culture of
the Seventies. However, a fortiori, Dijkstra would throw up if he saw
Petey's code.
Also untrue, so far as I know -- assuming he's talking about the db_header
thing.

Simply saying I'm a fucking liar without at least recapitulating any
proof you have shows you're:

* A bad writer who struggles (unlike me) to express himself
* Without a solid and elegant proof
* A liar yourself

No, you didn't even bother to initialize in the definition-declaration
which means that the code could "work" given random storage contents,
this being the worst type of bug: the unknown bug.

"Don't compete with me: firstly, I have more experience, and secondly,
I have chosen the weapons."

- Dijkstra
 
S

spinoza1111

I must be misunderstanding something, because I thought the point of
those primitives was that any program could be expressed using them.
If that's the case, surely any program, even an ill-structured one [*],
can be so expressed?  What does "irreducible" mean in context?

Perhaps Nilges has some private meaning in mind.  That said,
translating C switch statements into Bohm Jacopini primitives is
quite straightforward.

Only in the sense that Bohm and Jacopini PROVED that "for every
algorithm that uses more than the favored three control structures,
there exists an equivalent algorithm that does not". There are, in
fact, automated ways to translate nonstructured Coding Horrors into
structured code.

However, it was quickly discovered that the output of such tools was
if anything less readable than the original mess, the output being
littered with "Boolean flags". Dijkstra's heuristic observation was
not really about "code" as it was of the type of personality who
simply would not want to code a fallthrough case unless he were
writing very tight, very low level OS code...of the sort that the
Walter Mittys of this newsgroup, flies who dream they are men who cry
on awakening to dream again, fantasize they are doing when they
buttfuck C code.

This sort of personality, which I saw become extinct in programming
(who was often a female of Hippie tendencies) has been pushed out by
creeps like Dweebach, who in my experience at Bell Northern Research:

* Themselves write unmaintainable and unreadable code not only bug
ridden but systematically using, out of a unique combination of
stupidity and vanity, the wrong approach (such as using strchr to find
%s)

* Steal the intellectual production of their colleagues as Peter is
attempting to do here

* Backstab and lie consistently
[*] Not that I necessarily think the code in question is ill-structured.

"Structure" in programming is a many splendored thing.  The term,
structured code, is usually taken to mean code that has nested
flow control.  In that sense the code in question is structured;
however the construct in which it is embedded is unstructured.

I suggest you don't know what you are talking about. I saw the rapid
evolution of "structured programming", which meant something precise
to the successful Chief Programmer of a New York Times information
bank which I use today every time I search the Times site on the Web,
a Mr. FT Baker, to a slop meaning, a thug meaning: "it's structured if
it don't make me think".

In 1972 it meant "uses the Bohm Jacopini control primitives as
itemized in their paper, perhaps enhanced with one trip do until and a
case statement WITHOUT ANY FALLTHROUGH, and with subroutining".
Fallthrough was excluded because it is not needed when you have
functions, preprocessor macros, or inline functions, and it makes
explaining your switch statement impossible in practice. Furthermore,
it was required that the switch statement be translatable to a nested
If, and this is not possible with fallthrough.

But, of course you see that "the construct in which it is embedded is
unstructured", and Peter is writing toy software, not a demanding OS.
Therefore, he is incompetent because all competent programmers after
Bohm-Jacopini (and, according to Dijkstra, before) restricted
themselves in most situations to completely, not partially, structured
code.
 
S

spinoza1111

He did.  And it didn't.

Worst kind of bug: a bug that doesn't cause your code to fail. But
hey, what the **** does a clown like you care?
Actually, no.  In the context that tool was intended to be used, it would
be called hundreds of thousands of times in a time-critical hunk of stuff,
such that the cost of starting up a script interpreter would be prohibitive.

A new excuse for poor workmanship!

I'm not up to speed on Linux: but for some time on .Net we've known
all about just in time compilation.

Most "script interpreters" have APIs to circumvent the "loading" time.

Furthermore, I'd have to ask why you are replacing a pattern in a
directory "hundreds of thousands of times". You see, in any reasonable
scenario, that pattern is a device for the user to abstract the name.
I think this is therefore an instance of incredibly poor workmanship,
in which you are REPEATEDLY changing %s (and any other %c pattern, at
least in the first version) in the same places and in the same string
because all other evidence (off by one strlen, reversal of conditions,
and your queue.c horror) shows you don't know your job.

But even granting this point, there's still the basic design error,
and that was to

1. Include string.h
2. Not use strstr for %s, which is a string

Because Nilges is a kook.  He's unreliable in comprehending simple English,

You don't write "simple English", and "comprehending me" for an
autistic **** is "agreeing with me or I have a tantrum".
he writes long and unrelated rants, he frequently refuses to answer simple,
direct, and topical questions, and his obsession with the issue has nothing

Hey, motherfucker. You have any simple, direct and topical questions,
make sure I see them by sending them by email. You do not speak to me
directly because you're a sissy and a coward. Saying that I refuse to
answer questions when you don't ask them of me is insane.
to do with me, so far as I can tell.

When he first posted about this in clcm, I responded and asked a number of

You introduced yourself. But during that "question time", it was I who
had the questions and comments on the overall approach. You never
answered those questions. Instead, almost immediately, you launched
into a global assault on my credibility, enabled by Richard
Heathfield, a destructive prick who thinks he runs this newsgroup and
clcm.

I then sent you email and you deleted the first email unread, although
it was a good faith effort, to which I referred in the public space,
to see if we couldn't tone down the "moron" and "kook" accusations on
your side, and my critique of you as a technician and a person, based
on my gradually dawning realization that you, sir, are a fraud
unfortunately backed by some sort of corporation...that is using you
to steal intellectual production.
relevant, technical, questions.  They went largely ignored because he has no
answers to them.  He's not worth arguing with, except in that he sometimes
says something technically wrong in a way that newbies could learn from seeing
a correction to.

News flash: you need to return to school and thereby disambiguate "my
pet coding shibboleths learned from other wet behind the ear geeks
scarcely older than I" and technology.
[Peter claims to have fixed the %s/%t confusion but his fix did not
address the ontological heart of the matter: that %s and %t are
strings, and IF you include string.h, THEN you need to use strstr.]

This, too, is untrue, but it's also worth pointing out that the '%s' thing
(there was no "%t", ever) was, in fact, "fixed" by switching to strtstr.

(Sigh). As I recommended. And you failed to give credit. You are a
fraud and a thief, Dweebach, and this issue is not going away.
Yup.

Speaking of which, I'm going to go use my advanced education and theoretical
background to go help a friend unload shingles from a truck.

You do that. But it doesn't prove that you're Authentic. My guess is
you'll unload a few and then supervise.
 
S

spinoza1111

spinoza1111  said:
[ snip ]
Search me.

Didn't you say above that it did?




In the context such a tool is intended to be used, you
don't use C. Instead, you use a scripting language with builtin string
handling such as Rexx for the IBM mainframe, Visual Basic .Net or
Visual Basic for Applications on Microsoft platforms, or awk or its
descendants on Linux and unix. The code was completely useless to
anyone here as opposed to the instructional utility of demonstrating
how to learn string handling from people like Willem and Ben (and me)
by discarding string.h. It was a vanity effort which I think Peter
meant to show that he was qualified to code C. As such, he
demonstrated to me that he's far less qualified than he thinks he is,
and far less qualified than Heathfield, who has a good grasp of the
trees but sometimes gets lost in the forest. This has been confirmed
in recent weeks by each code snippet and program he has posted.
But...he would merit my silent pity, and I would make no comment, save
for the Schildt canard, and his treatment, last January, of my
collegial request for an exchange of email about Schildt. As you will
recall, he discarded my email unread and proceeded to repeatedly call
me (a fellow Apress author) "insane", a "moron", and a "kook". I am
none of these things.

Quoted on the off chance that Seebs feels inclined to remind(?) us *why*
this e-mail was deleted unread.  




The worst type of bug is one that doesn't "actually fail", most of the
time, or even never, when, years later, a maintenance programmer makes
a small change (such as adding %t as a different type of pattern, and
not expecting it to be changed), only to have the new code fail.
Professional programmers produce, as I produce, tokens of a type or
set of alternative texts which meet a range of neighboring
possibilities in such a way that it's easy to change from one token to
the next.
[Peter claims to have fixed the %s/%t confusion but his fix did not
address the ontological heart of the matter: that %s and %t are
strings, and IF you include string.h, THEN you need to use strstr.]
This sounds like the ravings of a "crazy man" who caught schizophrenia
unwashed, or people who "washed" out of other fields and came, filled
with self-hatred, shame and anger, to programming. But the fact is
that like a number of older programmers (such as Richard Stallman), I
spent a number of summers yearning for a CPU and drycoding programs,
along with learning mathematics, logic and the foundations of
mathematics. I also studied theater and literature in that time so
that by the time I was a graduate student in CS, I'd learned that
people and ideas matter far more than machines and software.
I'm afraid that Peter never had this chance, nor the chance to solve
difficult problems on his own, but not on his own terms. He was
sitting in a university, presumably with Mommy and Daddy paying his
tuition, unlike my middle class black and female students at DeVry,
who staggered in exhausted from working two jobs to pay their
tuition.
If he was interested in computers, it seems reasonable that he would
have taken a class; I jumped at the chance, in 1970, to take the first
class in computer science at Roosevelt University in Chicago.

We all get 168 hours per week, but we make different choices
about what to do with them.  Didn't you say that at some point
stop taking classes because you had other obligations?  What is
that but a choice ....  <shrug>

Again, you're a corporate commodity fetishist, Ms M, who actually
thinks arguments can be resolved by selecting some suitable abstract
and "fuzzy" concept, expressed in "simple" but on investigation
completely meaningless language, which covers up an actual difference
and actual victimization.

Which is a fancy way of saying, Ms M, that you're making the tu quoque
logical fallacy.

You see, Peter, probably out of fear that his "learning disorder" (of
a sort that was not recognized when Larry Ellison, or I, were in
school) would disadvantage him, refused to even start on any sort of
acceptable journey.

Whereas when I was an undergraduate, there were no computer science
classes at my nontech uni. When they were announced four years after I
got my BA, I signed up because I had tuition support and ONE child.
But after I'd completed the heavy class work required (computer
architecture, compiler development, theory of computation, data base
theory, microcomputer architecture, etc.) with an A+ average, we had
our second child and the price of gas shot up after Iran took the US
embassy.

I was by then working for a Chicago firm that required a 45 hour plus
week. I was getting involved in some very interesting projects
including developing tools in which software for the very first
cellphone released for sale, and figuring that I'd learned enough, I
decided, with some reluctance, not to finalize the MSCS. This freed me
up to move to Silicon Valley and get a pay increase to cover the late
Carter inflation.

Now, there is simply no comparision between this and Peter sitting in
his bedroom with his head up his ass, fantasizing that he knew how to
program. And when I was forty, as Peter now appears to be, I was
delivering a paper on a parser generator I'd written in Rexx to
generate a parser for Rexx, as a result of my studies.

However, even in the 1980s, I noticed that programmers were rapidly
"learning" to disrespect universities and to take pride in a complete
disconnect between their work and what they'd learned in school. It
was increasingly claimed by them that they were working at a "cutting
edge" that academicians didn't dare enter even when, and usually when,
you investigated their work to find out that they were screwing the
pooch out of ignorance. They were using fallthrough case unnecessarily
and repeatedly making the same string transformation, using the wrong
approach, without bothering to create an index of the places where to
insert the string. They were constructing "linked lists" in which each
node had megabytes of data, unnecessarily.

They were repeating the same mistake mainframe programmers had made in
the 1960, which was to think that intellectually manageable programs
could be written without a stack mechanism, but on a far grander
scale. And if you asked the hard questions (such as why the **** would
I want a strstr that constrains me to limit the string length to an
too-small value, OR occupy a huge address space), these questions were
dismissed as "academic".
I can
only conclude that he's developed a passive-aggressive style which is
better treated by traditional psychiatry and outdoor service work than
medication...but would caution you, saying that that diagnosis is
probably irresponsible, possibly as irresponsible as people who
diagnose me as schizo because they can't read worth dick.

[ snip ]
 
S

spinoza1111

Which is fine. But in the case of ack and nak in queue.c, you
fallthrough over code which at the time you wrote it contains no valid
case handling, but could easily be changed by someone who doesn't
realize that ack and nak are invalid for the client, as you say you
state in the documentation. The implicit rule is that the maintainer
may NOT put actually valid cases under ack and nak!
The reason why we avoid unstructured code (which is what a fallthrough
switch() is, being irreducible to the Bohm Jacopini primitives unlike
other switch() statements

I must be misunderstanding something, because I thought the point of
those primitives was that any program could be expressed using them.
If that's the case, surely any program, even an ill-structured one [*],
can be so expressed?  What does "irreducible" mean in context?

You are misunderstanding something. Sure, nothing's "irreducible"
since any unstructured program can be automatically structured (that
results from Turing equivalence). But as I indicate elsethread,
Dijkstra, like Confucius, was looking for the type of person who would
prefer not to be unstructured even as Confucius looked for the
gentleman, and would grow out of wanting to fall through, as I did in
1972 at the ripe age of 22.

His "elegance" was a moral category which recognized that the ultimate
source of value is the Other Person, Levinas, "the other whose face is
the face of God removed from the world", the other who people so
readily call a "troll" (where becoming familiar with the particular
other's personality and actual skills and lack of decency towards
others, and calling him a fraudulent motherfucker, is quite
different).

Because for Dijkstra people and their human culture is infinitely more
important that machines or software, programming is the moral act of
documenting precisely your intentions as to use a computer to an
Other.

Anyone who would prefer to be cute and write a fallthrough case
because he think's its cute and shows that he should be writing OS
code and not scripts is a cad on this account, and because, as TW
Adorno showed, "intelligence is a moral category", a stupid cad.
[*] Not that I necessarily think the code in question is ill-structured.

Oh we must be "objective". I'm afraid that Adorno showed that being
"objective" for low level people in an administered world, which is
what we are, which is what you are, is to be blinded as were Odysseus'
men to most of reality. The code is ill-structured, dear heart.
but unnecessary for a Turing complete
language) is precisely to avoid these gotchas. Many programmers do not
read the documentation, not so much out of sloth, instead because the
documentation is so often out of date or wrong.
You've never learned to write for true readability, which is something
you have to learn by taking computer science classes for the most
part. This is because in a class, you have to hand in your work to an
instructor or graduate assistant who must grade it. Whereas many
corporate groups in my experience are designed by their own members
with the silent complicity of top management to avoid quality control
so as to meet deadlines, with code reading given at best lip service.
This means that I think you are lying when you claim that queue.c is a
group effort where you reviewed the code. I think that you're a script
kiddie who's not allowed to write code like a man because, as you
yourself concede, you get simple things wrong in a field where (news
flash) we build complex systems out of simple things, what Dijkstra
called a cloud of mosquitos humming in harmony. I don't think a
competent coworker would have stood for a Duff's device, or
fallthrough case, because they are legacy and idiomatic styles, and
unacceptable today.

[ snip ]
 
S

Squeamizh

Quoted on the off chance that Seebs feels inclined to remind(?) us *why*
this e-mail was deleted unread.  

Hey, B. L. Barneby, why don't you get a clue? What exactly are you
trying to extract from spinoza? By republishing his nonsense, you
just lure weak-willed saps to respond indirectly, and further pollute
this newsgroup. If you somehow get something out of reading his
tripe, then I suggest you check the archives; you'll find enough to
keep you pacified for a year or two. If you simply can't resist
taking your little shots at spinoza, then I suggest sticking to email
(CC Seebs if you like).
 
S

Seebs

Just so. The problem, however, has nothing to do with automated
tools. Rather it lies in the choice of primitive constructs.

Exactly. You can't make code any prettier using insufficiently
powerful constructs, really.
What B & J and the early enthusiasts did not immediately
recognize is that flow control constructs vary considerably in
power. The while loop/if-then-else combination is quite weak.
The table of flow construct strengths runs much as follows:

while loop
while loop + if-then-else
forever loop + escape
goto
function invocation/return
computed goto/select-case/function pointers

There are rigorous proofs showing there are program types for
which replacing a stronger construct by weaker constructs can
only be done by either an exponential growth in program size or
by a polynomial growth in program execution time.

I'd like to point out, though: While that's true, it's also usually
the case that things using the later forms can be substantially more
complicated to understand.

.... can be.

There is also the fact that a well-constructed design using function
pointers can be dramatically EASIER to understand than a more
elaborate series of other constructs.

There's a lot to be said for:

(evalfns[e->op])(e);

over
switch (e->op) {
case OP_ADD:
/* code here */
break;
case OP_SUB:
/* code here */
break;
case OP_MUL:
/* code here */
break;
case OP_DIV:
/* code here */
break;
}

I actually considered doing more of that for pseudo (and there is at least
one table of function pointers in there, sort of), but the amount of shared
code in the handlers made it less appealing.

-s
 
S

spinoza1111

Then we are in agreement.  Excellent.




Just so.  The problem, however, has nothing to do with automated
tools.  Rather it lies in the choice of primitive constructs.
What B & J and the early enthusiasts did not immediately
recognize is that flow control constructs vary considerably in
power.  The while loop/if-then-else combination is quite weak.

This makes no sense, and the problem is the sloppy use of the word
"power". People use this word with a deliberate vagueness in
discussing programming.

Writing a correct program is not a matter of "power" it's a matter of
truth. It is a misleading metaphor revelatory only of sexual anxiety
to speak as if the BJ constructs didn't have enough "power" for what
you want to do. Your responsibility as a programmer is to get it right
(the truth) and you cannot even unrigorously prove that if we give you
more power you won't **** it all up; quite the opposite; IBM
programmers of "big iron" did less than PDP8 hobbyists in the 1960s.

Dweebach is saying that "yeah yeah I know that you can do anything
with the minimal BJ constructs, and that's great for first year
compsci students, but I am, despite my stupid long hair and Goth T
shirt, a Grownup and I have an important job, therefore, despite the
fact that I don't need fallthru I must get it! Mom!".

Whereas a real programmer is ascetic where it counts.
The table of flow construct strengths runs much as follows:

    while loop
    while loop + if-then-else
    forever loop + escape
    goto
    function invocation/return
    computed goto/select-case/function pointers

There are rigorous proofs showing there are program types for
which replacing a stronger construct by weaker constructs can
only be done by either an exponential growth in program size or
by a polynomial growth in program execution time.

This pompous statement, while true, has nothing whatsoever to do with,
and in no way dignifies, Dweebach's code. I doubt that anyone here
besides myself, Willem, and perhaps you have ever done anything like a
"rigorous proof". For all other posters, it is Lacan's hidden Phallus,
just the internalized voice of authority with which they've never come
to terms.

The insane logic is that "Dweebach might be right because over here I
found something out", literally.
[*] Not that I necessarily think the code in question is ill-structured.
"Structure" in programming is a many splendored thing. =A0The term,
structured code, is usually taken to mean code that has nested
flow control. =A0In that sense the code in question is structured;
however the construct in which it is embedded is unstructured.
I suggest you don't know what you are talking about.

You are quite at liberty to suggest any sort of foolishness that
you like.  Be my guest.

Richard Harter, [email protected]://home.tiac.net/~cri,http://www.varinoma.com
It's not much to ask of the universe that it be fair;
it's not much to ask but it just doesn't happen.
 
S

spinoza1111

Exactly.  You can't make code any prettier using insufficiently
powerful constructs, really.








I'd like to point out, though:  While that's true, it's also usually
the case that things using the later forms can be substantially more
complicated to understand.

It's obscene for a programmer, especially for a horrid little person
like you, to tell others how to understand.
... can be.

There is also the fact that a well-constructed design using function
pointers can be dramatically EASIER to understand than a more
elaborate series of other constructs.

There's a lot to be said for:

        (evalfns[e->op])(e);

over
        switch (e->op) {
        case OP_ADD:
                /* code here */
                break;
        case OP_SUB:
                /* code here */
                break;
        case OP_MUL:
                /* code here */
                break;
        case OP_DIV:
                /* code here */
                break;
        }

I actually considered doing more of that for pseudo (and there is at least
one table of function pointers in there, sort of), but the amount of shared
code in the handlers made it less appealing.

(Sigh). In handling as above a set of operations there is "shared
code" (the need for common logic) in many cases. In writing the
compiler for "Build Your Own .Net Language and Compiler", my
interpreter had a large number of "shared" operations. But rather than
use fallthru, I called functions.

In Visual Basic, I only had "functions". But there's less of an excuse
for not developing "functions" for the shared code in C because in
addition to functions that are called by way of the stack with
parameters, you also have inline and macro style.

But: if you do this with any moral seriousness you end up as I end up
with unfamiliar looking code, because most programmers today lack not
only mathematical training and language abilities, they also are in it
to make money, and feel (as a result of Reaganism and Thatcherism in
the developed world, and, possibly, religious fundamentalism
worldwide) that they only need to write the minimal solution in all
real cases. This is why good code is nonexistent for the most part in
this ng, and when it does appear, people call it "the worst code I've
ever seen".

Dijkstra wasn't talking about some sort of idiotic macho "power" in
structured programming, but a type of (Confucian) gentleman with a
Confucian respect for "propriety" and the "rites". Confucius made the
kow-tow to government administration buildings, a custom already
considered "unnecessary", foolish, "inefficient" and out of date in
the fifth century BC, and called by early Christian missionaries
thousands of years later idolatry. But Master Kong saw the Duke of Lu
and Qi as so often cutting corners and failing to do what they say
that nobody trusted each other.

Confucius discovered something that Dijsktra and Weinberg discovered:
that groups of men needed to have a shared committment to the "truth".

The code that results from a shared committment in a Confucian work
group will look different for each author for the same reason
different writers of Chinese characters have different calligraphic
styles that are recognizable, but each example will be at a MUCH
higher level of quality than anything submitted by Dweebach. No
example would start out with a copyright AND a copyleft, no example
will fail to initialize important pointers to structs such as
db_header to null, and none will #define a symbol and fail to use it.

There are millions of right ways to write a multistroke Chinese
character such as è­˜ for the same reason there are millions of
righteous people in a well-ordered society. But some people, like
Dweebach, seem to have a gift for the wrong way, and this gift, owing
to the corporate demoralization of American and related society, is
now the deviant norm, and as a result, my code is indeed "bad" to the
bone...in a programming profession that is self-destructing. It's like
writing traditional Chinese characters in mainland China, and it is
also a kow-tow to institutions that have over time betrayed me and
dispossessed my children.
 
S

spinoza1111

Would you prefer "strength" instead? If not that, would
"cornbread" do?  

What's wrong with truth? The problem is the authorized replacement of
the will to a collective truth by the celebration of a power which
only one person will get, and news flash: because none of you losers
will get any real power, you're damned fools for not rededicating
yourself to truth.

The truth of structured programming is that you can construct complex
devices in an understandable way with simple elements, scaling up.
"Power" has nothing to do with this. "Power" is getting other people
and machines to do your bidding against their will, and a gentleman is
bored with this type of "power".
 
S

spinoza1111

Well I certainly am bored with your type of power.

It's not a "type of power". It's the truth of a program.
In the mean time I will commend to you the thought that your
"truth of structured programming" may have some qualifiers.

....without specifying them.

"At University we learned that only Truth matters. At Mathematica,
Inc., we know that only Secrets matter."

This cheap Nietzcheanism against which Dijkstra struggled is self-
contradictory. For the same reason that Dweebach is to the wise a fool
when he says "that's a first year computer science problem" without
having taken a first or any year CS class, the truth-is-power boys
have to appeal to truth.

Slow and right is useful because true, but fast and wrong (what
machinists call scrap at high speeds) is useless. Computer operators
liked slow mainframe programs in the old days. It meant that they
could do their homework for school at the cute little Formica table
that the 360 had, or blaze up a joint, or drop acid (some mainframe
computer rooms allowed operators to smoke because the blowers were
said to get rid of the smoke particles).

But then, in the early 1980s, we all were given a presentation by IBM
on their new disk technology. It featured a spectacular picture of a
smoke particle versus a read head, where the read head was like a
Boeing 747 and the smoke particle a boulder on the runway. Poor read
head.

So we all stopped smoking (I had to start running marathons because
smoking is soooooo much fun).

The problem was that the message was that "machines are more important
than human labor and desire at all times and at all circumstances". Of
course, the personal computer was supposed to change that, and it did
for some people...but not for people for whom changing a screen saver
is a termination offense, and definitely not for people that have to
use Dweebach's code for changing %s to ****-all, who have to watch
dully while it carries out this operation 10K times.

Basically, the field was overrun by thugs, the sort of thugs that
whenever they see truth want to change it back to power. Been going on
since the dawn of man, as seen in that film 2001.

Sure, my "truth" was that:

* Structured programming is cool.

* It could be extended to languages without control structures, by
putting numbered (not "meaningful" labels) on lines by themselves in
assembler, and separating these labels as in the code sample I gave
you when they belonged to different control structures.

In a letter in response to my 1976 article, the "structured
programming expert", a man who was commercializing structured
programming, Edward Yourdon, said that my notation did NOT constitute
"structured programming". He and others said that "structured
programming must be done in a language with control structures".

[I met Edward Yourdon five years later in the context of a job
interview. He wanted structured programming trainers to deliver
classes in Latin America. Should have taken his offer.]

But his view contradicted what was merely my own personal experience.
When, in 1971, I coded assembler with fallthrough, self-modifying
code, and other such practices, I could get a working and fast
program, but only by working longer hours.

This is why I think it is childish to use fallthrough and Duff's
stupid device in C. C supports Yourdon-style structured programming.
Having had the experience of debugging assembler programs (and one
[punched] card machine language programs that had to include their own
bootstrap loader and disk formatter), having been a REAL programmer
back when men were men, women were women and the sheep were nervous, I
am at best amused by wet behind the ears punks like Dweebach. But when
they start ruining reputations, that's when I get mad.
 
 
S

spinoza1111

Well I certainly am bored with your type of power.

It's not a "type of power". It's the truth of a program.


In the mean time I will commend to you the thought that your
"truth of structured programming" may have some qualifiers.

...without specifying them.

"At University we learned that only Truth matters. At Mathematica,
Inc., we know that only Secrets matter."

This cheap Nietzcheanism against which Dijkstra struggled is self-
contradictory. For the same reason that Dweebach is to the wise a fool
when he says "that's a first year computer science problem" without
having taken a first or any year CS class, the truth-is-power boys
have to appeal to truth.

Slow and right is useful because true, but fast and wrong (what
machinists call scrap at high speeds) is useless. Computer operators
liked slow mainframe programs in the old days. It meant that they
could do their homework for school at the cute little Formica table
that the 360 had, or blaze up a joint, or drop acid (some mainframe
computer rooms allowed operators to smoke because the blowers were
said to get rid of the smoke particles).

But then, in the early 1980s, we all were given a presentation by IBM
on their new disk technology. It featured a spectacular picture of a
smoke particle versus a read head, where the read head was like a
Boeing 747 and the smoke particle a boulder on the runway. Poor read
head.

So we all stopped smoking (I had to start running marathons because
smoking is soooooo much fun).

The problem was that the message was that "machines are more important
than human labor and desire at all times and at all circumstances". Of
course, the personal computer was supposed to change that, and it did
for some people...but not for people for whom changing a screen saver
is a termination offense, and definitely not for people that have to
use Dweebach's code for changing %s to ****-all, who have to watch
dully while it carries out this operation 10K times.

Basically, the field was overrun by thugs, the sort of thugs that
whenever they see truth want to change it back to power. Been going on
since the dawn of man, as seen in that film 2001.

Sure, my "truth" was that:

*  Structured programming is cool.

*  It could be extended to languages without control structures, by
putting numbered (not "meaningful" labels) on lines by themselves in
assembler, and separating these labels as in the code sample I gave
you when they belonged to different control structures.

In a letter in response to my 1976 article, the "structured
programming expert", a man who was commercializing structured
programming, Edward Yourdon, said that my notation did NOT constitute
"structured programming". He and others said that "structured
programming must be done in a language with control structures".

[I met Edward Yourdon five years later in the context of a job
interview. He wanted structured programming trainers to deliver
classes in Latin America. Should have taken his offer.]

But his view contradicted what was merely my own personal experience.
When, in 1971, I coded assembler with fallthrough, self-modifying
code, and other such practices, I could get a working and fast
program, but only by working longer hours.

This is why I think it is childish to use fallthrough and Duff's
stupid device in C. C supports Yourdon-style structured programming.
Having had the experience of debugging assembler programs (and one
[punched] card machine language programs that had to include their own
bootstrap loader and disk formatter), having been a REAL programmer
back when men were men, women were women and the sheep were nervous, I
am at best amused by wet behind the ears punks like Dweebach. But when
they start ruining reputations, that's when I get mad.
  




Richard Harter, [email protected]://home.tiac.net/~cri,http://www.varinoma.com
It's not much to ask of the universe that it be fair;
it's not much to ask but it just doesn't happen.

"I mentioned the non-competitive spirit explicitly, because these
days, excellence is a fashionable concept. But excellence is a
competitive notion, and that is not what we are heading for: we are
heading for perfection."

- Dijkstra

I recently saw my neighbor, Chow Yun Fat, star in Confucius, a
biography of the ancient Chinese philosopher. I was struck by a
strange parallel between Confucius' and Dijkstra's aphorisms.

The Master said, 'Is it not a pleasure, having learned something, to
try it out at due intervals? Is it not a joy to have friends come from
afar? Is it not gentlemanly not to take offence when others fail to
appreciate your abilities?

å­æ›°å­¸è€Œæ™‚習之ä¸äº¦èªªä¹Ž...

Like Confucius, Dijkstra was a humble advisor to the Duke of Burroughs
who sagely helped Burroughs conquer market share; by the time Dijkstra
left, most American and European banks were using Burroughs equipment,
which was based on stacks and Algol. But Dijsktra made many enemies
amongst the viziers of other princes, who took counsel amongst
themselves, saying, "this Dutch fuckwad is an ivory tower intellectual
whose code probably runs slowly, let us plot behind his back to take
his friends from him".

Therefore Dijkstra went to the Duke of Texas, who wanted to use him to
construct siege engines with which to conquer Alabama, but Dijkstra
shook his head, and asked to teach.

Yen Yüan asked about perfect virtue. The Master said, "To subdue one's
self and return to propriety, is perfect virtue. If a man can for one
day subdue himself and return to propriety, all under heaven will
ascribe perfect virtue to him. Is the practice of perfect virtue from
a man himself, or is it from others?"

Yen Yüan said, "I beg to ask the steps of that process." The Master
replied, "Look not at what is contrary to propriety; listen not to
what is contrary to propriety; speak not what is contrary to
propriety; make no movement which is contrary to propriety." Yen Yüan
then said, "Though I am deficient in intelligence and vigor, I will
make it my business to practice this lesson."

é¡æ·µå•ä»å­æ›°å…‹å·±å¾©ç¦®ç‚ºä»ä¸€æ—¥å…‹å·±å¾©ç¦®...

And a student asked Dijkstra, why is it, Master, you write with pen
and ink that you make yourself? Let me teach you Microsoft Word.

Dijkstra admonished his pupil, saying, whilst I carve the pen I think
about the proof of my algorithm. Whilst I grind the ink I think of
counterexamples. Then as I write I never have to blot a line, or use
the Paper that is Liquid. At all times my mind is focused on
proprieties, whereas when I use Microsoft Word, and I click and image
to make it fit the page tightly, my mind is distracted, for the image
pops to the top of the page.

From this, I pass into a rage, and throw my computer across the room.
My mind is no longer thinking of the proprieties.
 
C

Colonel Harlan Sanders

Quoted on the off chance that Seebs feels inclined to remind(?) us *why*
this e-mail was deleted unread.  

I think Nilges' response is reminder enough :

You don't write "simple English", and "comprehending me" for an
autistic **** is "agreeing with me or I have a tantrum".


Hey, motherfucker. You have any simple, direct and topical questions,
make sure I see them by sending them by email. You do not speak to me
directly because you're a sissy and a coward. Saying that I refuse to
answer questions when you don't ask them of me is insane.

Seebach displayed a saintly restraint in his responses to Nilges'
paranoid accusations for months before filtering him out.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,102
Messages
2,570,645
Members
47,246
Latest member
TemekaLutz

Latest Threads

Top