help w/ c/c++ problem

  • Thread starter Heinrich Pumpernickel
  • Start date
R

Richard Heathfield

Keith Thompson said:
Nevertheless, it's part of the standard.

I agree, of course. Nevertheless, it's utterly weaselish and useless.
"void main(void)" is ugly and its mother dresses it funny, and I've
never claimed otherwise.

I know.
I simply take issue with Mark's statement upthread:

| Then I'm afraid that both your book and your teacher are wrong. The
| C Standard REQUIRES main to return an int.

That statement is just incorrect. I don't particularly expect Mark
ever to admit this, so I'll gladly drop this now.

Fine by me. Arguing with Mr McIntyre seems to be a waste of time[1], and
I have stopped bothering.

[1] Except that it has educational value for newbies, of course. But
other people can do that just as well as I can, and probably with a
better temper, too.
 
R

Richard Heathfield

CBFalconer said:

Once implementation defined the action
is beyond the reach of the standard, and thus off-topic here. The
system is non-portable.

If that were the case, then the following program would be off-topic:

#include <stdio.h>
#include <limits.h>

int main(void)
{
printf("%d\n", INT_MAX);
return 0;
}

Is it, then, your contention that the above program is off-topic in
comp.lang.c?
 
K

Keith Thompson

CBFalconer said:
You are wasting our time. Once implementation defined the action
is beyond the reach of the standard, and thus off-topic here. The
system is non-portable.

Nonsense. We're talking about variations that are *explicitly*
permitted by the standard.
 
C

CBFalconer

Richard said:
CBFalconer said:



If that were the case, then the following program would be off-topic:

#include <stdio.h>
#include <limits.h>

int main(void)
{
printf("%d\n", INT_MAX);
return 0;
}

Is it, then, your contention that the above program is off-topic in
comp.lang.c?

No. The action is defined. The actual output may vary. Similarly
something that times the interval between two keystrokes.
 
C

CBFalconer

Keith said:
Nonsense. We're talking about variations that are *explicitly*
permitted by the standard.

Are you claiming that the resultant program is portable?
 
K

Keith Thompson

CBFalconer said:
Are you claiming that the resultant program is portable?

Of course not.

You wrote that "the system is non-portable". The word "system"
usually refers to implementations; what does it mean for an
implementation to be portable?

A *program* that takes advantage of such an extension is not portable.
I was disputing your claim that a program containing 'void main(void)'
is off-topic. It is certainly discouraged, but the fact that the
standard explicitly allows an implementations to document and accept
it is as topical as it gets.
 
H

Heinrich Pumpernickel

Heinrich Pumpernickel said:


Then find out for yourself, by reading the relevant language definition
specification, ISO/IEC 9899.


Perhaps he is, but he doesn't know much about C if he can't even get the
entry point right.

but he's a doctor
Then get a better book.

its not just some book, its called "C: The Complete Reference",
written by some famous and internationally renowed autor
("...world's leading programming author...", "...is a leading
authority on C and was a member of the ANSI/ISO committee that
standardized C...") and it spicifically says..........

You may also declare main() as void if it does not
return a value.
Better still, get ISO/IEC 9899.

our lib has copies of "The Annotated C Standard" that says
its ISO 9899:1990 on it, and it spicifically says..........

You are therefore free to declare main() as required
by your program.

next is an example of void main(void) .
 
D

Dave Vandervies

but he's a doctor

That is far from being a reliable indicator of knowledge about C.
(Some would claim it's inversely correlated; I wouldn't go quite that far,
but I wouldn't argue too hard against it either.)

its not just some book, its called "C: The Complete Reference",
written by some famous and internationally renowed autor
("...world's leading programming author...", "...is a leading
authority on C and was a member of the ANSI/ISO committee that
standardized C...") and it spicifically says..........

You may also declare main() as void if it does not
return a value.

I recommend you take a look at
<http://www.plethora.net/~seebs/c/c_tcr.html> and
<http://www.lysator.liu.se/c/schildt.html> before you take seriously
anything you've learned in this course.

our lib has copies of "The Annotated C Standard" that says
its ISO 9899:1990 on it, and it spicifically says..........

You are therefore free to declare main() as required
by your program.

next is an example of void main(void) .

If you read the standard as well as the annotations, you may realize
that the text of the standard on the page facing this example states
that this example is utter bullschildt.

It's also worth noting that the difference in price between this book
and a copy of ISO 9899:1990 (when it was available) reflects the value
of the annotations quite well.


dave
 
R

Richard Heathfield

Keith Thompson said:

[Chuck] wrote that "the system is non-portable". The word "system"
usually refers to implementations;

It does? I have never thought of "the system" as being an
implementation. I generally use the word either to refer to the host
environment (which may not even have an implementation installed on
it), or to a collection of programs I am writing that, together, do a
well-defined job.

For example, "FOO takes the data feeds from customers, and wibbles them
into some kind of common format. BAR produces summaries of their
ordering requirements. BAZ does the logistics calculations. QUUX works
out whether we need to build more grommets before we can meet the
orders. And MOONSHINE produces the final invoices and picking lists.
MANAGER ties all these together, and generally gets in the way of
anyone trying to do actual work."

***That's a system.*** To me, gcc isn't a system, merely a program.
Under the hood, of course, it's more complicated than that, but that
complexity can be ignored - if I try hard enough.

<snip>
 
R

Richard Heathfield

Heinrich Pumpernickel said:
but he's a doctor

So? Doctors can be stupid too.
its not just some book, its called "C: The Complete Reference",

Oh, I see. In that case, getting a better book isn't enough. You'll
actually need to burn the book you already have. I'm not usually a fan
of book-burning, but in this case it's justified.

By the way, it's now my opinion that you're trolling. If you're actually
serious, I suggest you take a look at the views of a couple of genuine
ISO C Committee members on Schildt's writings:

http://herd.plethora.net/~seebs/c/c_tcr.html - by Peter Seebach, ISO C
Committee

http://www.lysator.liu.se/c/schildt.html - by Clive Feather, ISO C
Committee
 
F

Flash Gordon

Dave Vandervies wrote, On 04/07/07 03:39:
That is far from being a reliable indicator of knowledge about C.
(Some would claim it's inversely correlated; I wouldn't go quite that far,
but I wouldn't argue too hard against it either.)

Depends on what he is a doctor in and how good a doctor he is. An
excelent medical doctor might make a very good C programmer as s/he
would be used to taking a lot of care to get things right.
I recommend you take a look at
<http://www.plethora.net/~seebs/c/c_tcr.html> and
<http://www.lysator.liu.se/c/schildt.html> before you take seriously
anything you've learned in this course.

Also search this group for the authors name and for bullshildt.
If you read the standard as well as the annotations, you may realize
that the text of the standard on the page facing this example states
that this example is utter bullschildt.

It's also worth noting that the difference in price between this book
and a copy of ISO 9899:1990 (when it was available) reflects the value
of the annotations quite well.

To understand this true comment you need to know that the book cost a
*lot* less than buying a copy of the standard. Thus the comment is
saying that the annotations have negative value. From everything I have
seen this is true.
 
K

Keith Thompson

Richard Heathfield said:
Keith Thompson said:
[Chuck] wrote that "the system is non-portable". The word "system"
usually refers to implementations;

It does? I have never thought of "the system" as being an
implementation. I generally use the word either to refer to the host
environment (which may not even have an implementation installed on
it), or to a collection of programs I am writing that, together, do a
well-defined job.
[...]

Oh, well. I was trying to come up with a reasonable interpretation of
his statement that "the system is non-portable". The "collection of
programs" meaning is reasonable, but we weren't talking about more
than program.

I'll let Chuck clarify if he wants to.
 
A

Army1987

Heinrich Pumpernickel said:
but he's a doctor


its not just some book, its called "C: The Complete Reference",
written by some famous and internationally renowed autor
("...world's leading programming author...", "...is a leading
authority on C and was a member of the ANSI/ISO committee that
standardized C...") and it spicifically says..........

You may also declare main() as void if it does not
return a value.


our lib has copies of "The Annotated C Standard" that says
its ISO 9899:1990 on it, and it spicifically says..........

You are therefore free to declare main() as required
by your program.

next is an example of void main(void) .
Not on all implementations.
3.4.3

1 undefined behavior

behavior, upon use of a nonportable or erroneous program construct or of erroneous data,

for which this International Standard imposes no requirements

4. Conformance

1 In this International Standard, ''shall'' is to be interpreted as a requirement on an

implementation or on a program; conversely, ''shall not'' is to be interpreted as a

prohibition.

2 If a ''shall'' or ''shall not'' requirement that appears outside of a constraint is violated, the

behavior is undefined. Undefined behavior is otherwise indicated in this International

Standard by the words ''undefined behavior'' or by the omission of any explicit definition

of behavior. There is no difference in emphasis among these three; they all describe

''behavior that is undefined''.

5.1.2.2.1 Program startup

1 The function called at program startup is named main. The implementation declares no

prototype for this function. It shall be defined with a return type of int and with no

parameters:

int main(void) { /* ... */ }

or with two parameters (referred to here as argc and argv, though any names may be

used, as they are local to the function in which they are declared):

int main(int argc, char *argv[]) { /* ... */ }

or equivalent;9) or in some other implementation-defined manner.

So an implementation is free *not* to define void main(void), and if it doesn't, the Standard imposes no requirement on a program
using it, not even that it mustn't publish a photo of your penis on Google's home page. Read www.c-faq.com, questions from 11.12a
onwards.
 
R

Richard Heathfield

Army1987 said:

So an implementation is free *not* to define void main(void), and if
it doesn't, the Standard imposes no requirement on a program using it,
not even that it mustn't publish a photo of your penis on Google's
home page. Read www.c-faq.com, questions from 11.12a onwards.


For the second time, I've had to dump you into the killfile. Last time
it was for 30 days. This time it's for 40.

(No doubt *someone* here will be monitoring your replies for
correctness.)
 
C

CBFalconer

Keith said:
Richard Heathfield said:
Keith Thompson said:
[Chuck] wrote that "the system is non-portable". The word "system"
usually refers to implementations;

It does? I have never thought of "the system" as being an
implementation. I generally use the word either to refer to the host
environment (which may not even have an implementation installed on
it), or to a collection of programs I am writing that, together, do a
well-defined job.
[...]

Oh, well. I was trying to come up with a reasonable interpretation of
his statement that "the system is non-portable". The "collection of
programs" meaning is reasonable, but we weren't talking about more
than program.

I'll let Chuck clarify if he wants to.

All I meant is that you can't cart the source to an arbitrary
machine/compiler, press the appropriate half dozen or so buttons,
and walk away with a functional program.
 
D

Dave Vandervies

Heinrich Pumpernickel said:


Oh, I see. In that case, getting a better book isn't enough. You'll
actually need to burn the book you already have. I'm not usually a fan
of book-burning, but in this case it's justified.

By the way, it's now my opinion that you're trolling. If you're actually
serious, I suggest you take a look at the views of a couple of genuine
ISO C Committee members on Schildt's writings:

I think you're a little bit hasty in deciding that he's trolling (though
perhaps only a little bit). If he's going by what's printed on the
back cover of his textbook and hasn't been exposed to more... unbiased,
shall we say... descriptions of the book and its author, Hanlon's Razor
certainly would apply here.


dave
 
K

Keith Thompson

CBFalconer said:
Keith said:
Richard Heathfield said:
Keith Thompson said:
<snip>

[Chuck] wrote that "the system is non-portable". The word "system"
usually refers to implementations;

It does? I have never thought of "the system" as being an
implementation. I generally use the word either to refer to the host
environment (which may not even have an implementation installed on
it), or to a collection of programs I am writing that, together, do a
well-defined job.
[...]

Oh, well. I was trying to come up with a reasonable interpretation of
his statement that "the system is non-portable". The "collection of
programs" meaning is reasonable, but we weren't talking about more
than program.

I'll let Chuck clarify if he wants to.

All I meant is that you can't cart the source to an arbitrary
machine/compiler, press the appropriate half dozen or so buttons,
and walk away with a functional program.

Ok, Your odd choice of words ("the system is non-portable" rather than
"the program is non-portable") threw me off.

I agree, of course, that the program is non-portable.
 
K

Keith Thompson

Richard Heathfield said:
Army1987 said:



For the second time, I've had to dump you into the killfile. Last time
it was for 30 days. This time it's for 40.

(No doubt *someone* here will be monitoring your replies for
correctness.)

<OT>
Naturally you can do whatever you like with your own killfile, but
IMHO you're overreacting.
</OT>
 
J

J. J. Farrell

Heinrich Pumpernickel said:



So? Doctors can be stupid too.



Oh, I see. In that case, getting a better book isn't enough. You'll
actually need to burn the book you already have. I'm not usually a fan
of book-burning, but in this case it's justified.

By the way, it's now my opinion that you're trolling.

Possible, but I suspect he's just young and naive. The assumption that
being a doctor means someone is an expert on C sounds like a person
who hasn't yet had to clean up after incompetent doctor coders. Which
is not to say that there are no doctors who are competent at C of
course - quite the opposite. There's probably much the same ratio of
competence to incompetence among C programmers who are doctors and C
programmers who are not. The nature of the incompetence differs
though ...
 
A

Army1987

Keith Thompson said:
<OT>
Naturally you can do whatever you like with your own killfile, but
IMHO you're overreacting.
</OT>

I've seen even ruder description of UB in this newsgroup (it could
show gay porn when your girlfriend is watching, it could write
"[very insulting message to the user and his mother]" to stdout and
exit, it could send a signed photo of your butt to the patriarch of
Moscow...) and nobody was killfiled.
Anyway, I can't force him to read my posts, neither should I if I
could.
 

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,781
Messages
2,569,615
Members
45,303
Latest member
Ketonara

Latest Threads

Top