Yet Another Spinoza Challenge

S

spinoza1111

Whoops, my bad.  Just goes to show, ain't nobody prefect. :)

Luckily and to my knowledge, you hadn't previously pissed off
Heathfield by being more popular and knowledgeable, so you're probably
safe from a systematic campaign of professional destruction.
 
S

spinoza1111

Kelsey said:
]
3. Which of the following is a correct prototype of getc? (A) int
main(void)
(B) void getc(void)
(C) int getc(FILE *)
(D) prototype getc(int)
B and C, although for different versions of getc.

According to 7.19.7.5p1, there are no "different versions" of getc.
You forgot long **l - certainly a double pointer if I ever saw one. :)  
As to the other answers, I see a pointer to double, but not quite sure
about a double pointer.

Using that argument, (B) is already a "double pointer" to an "int *".  :)

[...]
Since you can't even rely on known integer sizes, who knows?  We'll just
have to wait until I finish up my portable assembler...

Please show me a scenario where the answer can change based on "integer size".
Only the DS9K would be perverse enough to do D... but it would probably
chuckle a little, first. :)

I don't believe that even the DS9K would do (D), unless given something like
the code snippet I posted earlier.  (Sorry, but I never upgraded my DS3K,
and it does not reboot the system.  Though I do think I heard a slight
chuckle before failing to compile the code.)

Nice pedantic reply to a pedantic post.  :)

Of course, he did say that the test was "about on a par with the test on
which [spinoza1111] just scored 100%", so I doubt Mr. Heathfield put his
heart and soul into the "test".  And, given the vagarities of the original
"test", they may, in fact, be intentional.

Heathfield makes a point of keeping whatever lame escuse he has for a
heart and soul out of anything save the politics of personal
destruction, so as soon as I saw "especially for you" I decided not to
take the test.
 
J

James Kuyper

Kelsey said:
[snips]

According to 7.19.7.5p1, there are no "different versions" of getc.

Really? You mean it's absolutely impossible for me to create my own
function, called getc? News to me.

No, it's not impossible to create such a function. However, unless your
function has static linkage, it's undefined behavior. The prototype in
question declared getc() without specifying 'static'. Unless there were
also a prior declaration with static linkage, such a prototype gives
getc external linkage. Since the declaration doesn't match the standard
library function with external linkage of the same name, that gives your
code undefined behavior (7.1.3.2, 7.1.4p2).
 
J

jameskuyper

Richard said:
Actually, I think it is. Until you can explain a concept in such
mind-numbingly simple terms that even a stupid computer can
understand it, you won't get much useful programming done. Because
you have to get the explanation exactly right, you often find that
teaching a computer how to do <X> leads to an improvement in your
understanding of <X>.

"Explaining" some things in a way that a computer can understand is
often a lot easier than explaining those same things to some human
beings. I think it was the latter sense of "explain" that was being
used.
 
K

Keith Thompson

As I posted in a followup, the above was badly worded.
Do the processing phases disambiguate?

No. The standard (at least C99) requires that a translation unit
with a #error directive must not be successfully translated, but it
doesn't require it to be terminated during the preprocessing phase.
For example, the #error directive could cause the compiler to set
an internal flag that causes it to produce a diagnostic later on.
 
P

Phil Carmody

Keith Thompson said:
As I posted in a followup, the above was badly worded.


No. The standard (at least C99) requires that a translation unit
with a #error directive must not be successfully translated, but it
doesn't require it to be terminated during the preprocessing phase.
For example, the #error directive could cause the compiler to set
an internal flag that causes it to produce a diagnostic later on.

Many thanks, Keith. In some ways I wish it wasn't so, though, as
just getting all preprocessor issues out of the way is such a
simple concept. However, it's usually the way that the standard
permits flexibility in situations where it doesn't really matter
in the long run.

Phil
 
F

Flash Gordon

Kenneth said:
Tom said:
In <[email protected]>, Kenneth Brody
wrote:

<snip>



As I recall, the Standard says that a program which contains UB does
not
even need to be properly compiled. Is that correct?
In that case, what about:
=====
extern int i;
void foo(void)
{
i = i++;
}
#error Oops!
=====
Given the UB in "i = i++;", must the compiler still behave according
to the rules, and must it fail to compile the code?
My instinct says "yes", but I think a strict reading of the Standard
would yield the answer "no". UB is "behavior, upon use of a
nonportable or erroneous program construct or of erroneous data, for
which this International Standard imposes no requirements". Thus,
*all* bets are off, and this includes #error.

But if you really, really, *really* want to know for sure, this is
probably not the best place to ask - comp.std.c might be a better
bet.

Maybe I don't get the question but UB means runtime behaviour not
compile time behaviour.

i = ++i;

May be UB, but it's syntactically valid and should compile to *A*
result [of unspecified behaviour]. So the following #error should
provoke a diagnostic you expect.

It has been argued here in the past that a program which contains UB
need not even compile,

That is even claimed in the standard (in a non-normative footnote), so
it is a fairly reasonable position to take.
and has gone so far as to claim that the compiler
itself can "invoke UB" upon trying to compile such a construct.

Well, the compiler is allowed to behave in an undocumented manner, so
what is to stop that undocumented behaviour from being punching you n
the nose? Of course, they could document as a diagnostic causing demons
to fly out of your nose...
 
F

Flash Gordon

jameskuyper said:
Kelsey said:
[snips]

7. Given the definition n = 0; what value does n have? (A) 6
(B) 42
(C) 0
(D) a suffusion of yellow
I'm going with B, on the assumption that n is a pointer,

n can't be a pointer, because "n = 0" was specified to be the
definition. Therefore, this has to be C90 code, relying upon implicit
int.
... and the
architecture uses an oddball value for a null pointer which numerically
would evaluate to 42. Granted, a conforming C program is not supposed to
be able to _tell_ if this is the case...

There are few meaningful restrictions on conforming C programs; that's
not one of them. A strictly conforming program couldn't tell, because
the process of telling would give it different outputs on different
implementations of C. However, the following code has no syntax
errors, violates no constraint, and does not have undefined behavior:

#include <stdlib.h>
int main(void)
{
char *n = 0;
return 42 == (int)n ? EXIT_SUCCESS : EXIT_FAILURE;
}

The standard also says nothing to either mandate or prohibit a
successful exit status for this program.

Actually, it *could* contain undefined behaviour on some
implementations. 6.3.2.3 para 6 says

| Any pointer type may be converted to an integer type. Except as
| previously specified, the result is implementation-defined. If the
| result cannot be represented in the integer type, the behavior is
| undefined. The result need not be in the range of values of any
| integer type.
 
H

Herbert Rosenau

Use your common sense. There was a classic C same as there is an
English language. If we consider programming languages to be a type of
human language in which a "programming language" is actually (cf.
Knuth) a language for humans to communicate their intentions as to
using computers, then it's plain there was a classic C.

You does prove again that you quacks about things you konws nothing
about.

Which english does you mean? There are lots of english all named
simply english in default! Some samples: US englisch canadian english
scotrish englich walish englich irish einglis pidgin english, .......

There is at lest not a single language that is true that what one
means when one says it is english without saying which engish one
means.
Use your common sense and don't be a smart ass. This type of literal
hermeneutics destroys both charity and communication.

So, then tell us what C is meaning by 'a screen' and where that is
defined in the standard. Ah, I see, you are a duck quacking about
things you knows nothing about. Rigt, you hare only a twit like the
other twits around in this group like the naiva (or how the naive who
does like you knows nothing about C) who things that there is only one
OS running on the only existent processor who is selling a properitary
compiler that is not a C processor even as he claims that were one.



--
Tschau/Bye
Herbert

Visit http://www.ecomstation.de the home of german eComStation
eComStation 1.2R Deutsch ist da!
 
H

Herbert Rosenau

Use your common sense. Zero whitespace is different.

The inability to read with commonsense started the Herb Schildt
nonsense.

Ups, you are right. Herbert Schildt has started to write nonesenses!
His is allergic to any C standard like the twit you are.

Use your common sense and don't be a smart ass. This type of literal
hermeneutics destroys both charity and communication.

Not anybody is a twit like you! When one is not correct one is always
unable to write a program that does exactly what it should do -
regardless of the programming language. Only twits like you clames
that one must be incorrect like Herbert Schildt, spinozza<some decimal
values>, tiwit (or how his name is spelled or jacob naiva)

Use your common sense. What was your score?

You are a moron.
Whatever happened to the very idea that programming ability was partly
or wholly expressed in the ability to understand and to explain?

And why is you the one who lacks this ability always?

--
Tschau/Bye
Herbert

Visit http://www.ecomstation.de the home of german eComStation
eComStation 1.2R Deutsch ist da!
 
H

Herbert Rosenau

spinoza1111 said:
On Thu, 03 Sep 2009 00:22:53 -0700,spinoza1111wrote: [...]
5. What will this piece (snippet) of C code print to the screen?
printf("Hello World");

Since C doesn't define a screen - or require one - there's no expectation
that any output will be sent to "the screen", which may not exist at
all. Further, there is neither an \n or an fflush(stdout) involved, so
there may not be any output *at all*.

Use your common sense and don't be a smart ass. This type of literal
hermeneutics destroys both charity and communication.

Having worked on hardware that would not output _anything_ until getting a
complete line of text, I fail to see how his hermeneutic interpretation has
destroyed anything.

The twit knows nothing about C, as he constantly proves. Ever worked
with a a bit more compley system than a "hello world" program? The
output assigned to an IP stack, the input coming from another stream,
going round half the world through different programs ending up
somewhere nobody knows at concrete time. But twit quacks about screen
- proving he is a twit.


[...]
Use your common sense. What was your score?

Obviously 100%, since the answerer's "common sense" tells him so.
Whatever happened to the very idea that programming ability was partly
or wholly expressed in the ability to understand and to explain?

"Understand", yes. "Explain", I don't think was ever involved in the equation.

However, how does one "understand" ambiguous questions when more than one
answer is "correct"? How does one "understand" improperly worded questions
where no answer is "correct"?

Oh, twit knows that there must be a screen the ooutput has to go
because he knows nothing about reality, tqwit thingxs programming
language and human language are identical and there is no other human
language than english english and C is not a programming language at
all because he has not even really tried to learn it but hates it.

--
Tschau/Bye
Herbert

Visit http://www.ecomstation.de the home of german eComStation
eComStation 1.2R Deutsch ist da!
 
H

Herbert Rosenau

Use your common sense. Zero whitespace is different.

No, nobody who knows what C is thinks so.

int
x
;

The inability to read with commonsense started the Herb Schildt
nonsense.

True herbert Schildt started whth publishing nonsene. That's right and
proven by anybody who has tried to read the crap Schildt has
published.

Use your common sense. There was a classic C same as there is an
English language. If we consider programming languages to be a type of
human language in which a "programming language" is actually (cf.
Knuth) a language for humans to communicate their intentions as to
using computers, then it's plain there was a classic C.

What is classic C? What is the difference between a human and a
programming language? You are a moron by comparing then.
Use your common sense and don't be a smart ass. This type of literal
hermeneutics destroys both charity and communication.

Common sense is "there is no scrren, there is no keyboard, there is no
printer, no tty but a number of predefined streams associated already
with a real device when main() gets active in an hosted environment.

In an free standing environment there is in default not even known if
or if not there is a device present.

So spinoza has ahgain nothing than dumb quack, quack.

--
Tschau/Bye
Herbert

Visit http://www.ecomstation.de the home of german eComStation
eComStation 1.2R Deutsch ist da!
 
H

Herbert Rosenau

Richard Heathfield wrote:
[...]
9. What must the implementation do on encountering a #error directive
in a part of the source code that is not skipped by conditional
inclusion?
(A) ignore it
(B) convert it to a string
(C) fail to translate the preprocessing translation unit
(D) reboot the machine
[...]

Okay, switching back to "in all seriousness" mode...

As I recall, the Standard says that a program which contains UB does not
even need to be properly compiled. Is that correct?

In that case, what about:

=====
extern int i;
void foo(void)
{
i = i++;
}
#error Oops!
=====

Given the UB in "i = i++;", must the compiler still behave according to the
rules, and must it fail to compile the code?


No, anything thinkable can occure. That includes that the compiler
does anything it likes - including to burn out the building the
computer is connected through some kind of network, making it
impossible to switch the comuter is running the compiler until the
niagara falls are completely out of water - undefined behavior means
at lieast that: behavior that is undefined completely, so nothing can
be sayed about the behavior that occures.


--
Tschau/Bye
Herbert

Visit http://www.ecomstation.de the home of german eComStation
eComStation 1.2R Deutsch ist da!
 
K

Keith Thompson

Herbert Rosenau said:
[more of the same]

You does prove again that you quacks about things you konws nothing
about.
[...]

Herbert, spinoza1111 is a troll. He's been posting nonsense like
this for years, and repeated attempts to ask him to stop have failed.

He his wasting our time by posting this stuff. You, I'm afraid,
are also wasting our time by responding to it.
 
J

James Kuyper

Richard said:
In <[email protected]>, Herbert
Rosenau wrote:



If you are suggesting that Jacob Navia knows nothing about C, I have
to disagree. Whilst his knowledge is perhaps far from perfect, you
simply *can't* successfully maintain a not-quite-ISO-C-conforming
implementation for a number of years without knowing a thing or two
about the language. Since he has done so, he does.

I would disagree with the "far from perfect". He actually has a pretty
good knowledge of C; he just seems less knowledgeable than he actually
is, because he reacts so poorly when any deficiencies in his knowledge
are brought up. This makes those deficiencies far more noticeable than
they would be if he were capable of simply acknowledging them, and
moving on.
 
S

spinoza1111

spinoza1111wrote:
On Thu, 03 Sep 2009 00:22:53 -0700,spinoza1111wrote: [...]
5. What will this piece (snippet) of C code print to the screen?
  printf("Hello World");
Since C doesn't define a screen - or require one - there's no expectation
that any output will be sent to "the screen", which may not exist at
all.  Further, there is neither an \n or an fflush(stdout) involved, so
there may not be any output *at all*.
Use your common sense and don't be a smart ass. This type of literal
hermeneutics destroys both charity and communication.

Having worked on hardware that would not output _anything_ until getting a
complete line of text, I fail to see how his hermeneutic interpretation has
destroyed anything.

Working on incompetently designed hardware doesn't impress me, son. I
started out, remember, on the IBM 1401, which was a piece of shit out
of the box.
[...]
Use your common sense. What was your score?

Obviously 100%, since the answerer's "common sense" tells him so.
Whatever happened to the very idea that programming ability was partly
or wholly expressed in the ability to understand and to explain?

"Understand", yes.  "Explain", I don't think was ever involved in the equation.

However, how does one "understand" ambiguous questions when more than one
answer is "correct"?  How does one "understand" improperly worded questions
where no answer is "correct"?

You choose the best answer. That's how I got the highest verbal SAT in
the history of my school.

I'm tired of all this libertarian whining about tests here. Are you
even aware that tests were developed in France as part of the "career
open to talents" as opposed to careers open to sacks of shit in silk
stockings? Of course you aren't, and your libertarianism will return
us to the dark ages.

A test MUST be fair to all takers. For this reason, it shouldn't cater
to your narrow vision of reality as formed by one series of piece of
shit machines. Instead it must use the widest and most common
understanding of words in which #include is a "command", not some
garden gnome techie's private language.

Can you do these analogies? Betcha hate analogy questions!

C++ is to C as (choose the BEST answer):

A C is to BCPL
B C is to Algol
C Algol 68 is to Algol 60
D The Space Shuttle is to the Apollo
E Linux is to Unix

++i is to i++ as

A i++ is to ++i
B i+=1; return i; is to j=i; i+=1; return j;
C --i is to i--
D Chalk is to cheese
E Undefined! Undefined! Yog Sothoth! Ungll ungll crcchhhh....

#DEFINE a(b,c) b=c; is to #DEFINE a(b,c) b = c;

A #DEFINE a(b,c) b=c; is to #DEFINE a(b,c) (b) = (c);
B Tweedledum is to tweedledee
C #DEFINE a 1 is to #DEFINE b 1

Edward Nilges is to Richard Heathfield as

A Hyperion to a satyr
B Chalk is to cheese
C Toast is to tea
D Acid is to alklai

Rob Pike is to Edsger Dijkstra as

A Bob Cratchit to Ebenezer Scrooge
B Abelard to Heloise
C Ruysdael is to Rembrandt
D Chalk is to cheese

long long int is to long int as

A Three is to one
B Four is to one
C Sex is to fun
D Two is to one

Answer key below. No peeking!

C: as in "a brave but ultimately unsuccessful elaboration"

B: as in "the most sensible answer. Render unto me a break."

B: as in "white space matters not except inside quoted literals"

A: as in Hamlet

C: as in a second-rate grinder out of landscapes to a world class
artist

D: as in 32: 64
 
S

spinoza1111

In <[email protected]>, Kenneth Brody
wrote:





Actually, I think it is. Until you can explain a concept in such
mind-numbingly simple terms that even a stupid computer can
understand it, you won't get much useful programming done. Because
you have to get the explanation exactly right, you often find that
teaching a computer how to do <X> leads to an improvement in your
understanding of <X>.

As usual you have completely missed the point, the bus, the train, and
the channel ferry to boot.

I have gotten useful programming done since you were shitting your
pants during the scary parts of Scooby Doo, but I have always
understood better than you that Knuth is right. Programming isn't
making computers go fwing and blerrrppp and zap at all: programming is
not a child's game of faery lights. It is communicating your
intentions as to the use of computers to other human beings, and at
this Herb Schildt has succeeded, which is why you hate him. You
obfuscate, you confuse, you fail to understand, and this, to me, means
you are a failure as a programmer, unless programming is the lowest
form of dirtbag clerical activity known to man.

There is no solution to programming's Homeric nod, the fact that we
all code bugs. But were programmers able to explain data systems,
indeed were they only permitted, then there would be fewer "bugs" in
the sociological sense.
 
S

spinoza1111

"Explaining" some things in a way that a computer can understand is
often a lot easier than explaining those same things to some human
beings. I think it was the latter sense of "explain" that was being
used.- Hide quoted text -

- Show quoted text -

That is correct.
 
S

spinoza1111

You does prove again that you quacks about things you konws nothing
about.

Which english does you mean? There are lots of english all named
simply english in default! Some samples: US englisch canadian english
scotrish englich walish englich irish einglis pidgin english, .......

....and your English, which is truly unique...
There is at lest not a single language that is true that what one
means when one says it is english without saying which engish one
means.

Nonsense, mein Herr. The fact is that students world wide endeavor to
learn "standard", "received", "BBC" English, and not from social
snobbery, simply to be able to communicate. And I'd caution you from
ranting and inciting here in your own version of English. It is rather
disturbing.
 

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

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,066
Latest member
VytoKetoReviews

Latest Threads

Top