Re: The worst 'hello world' example ever written...

D

David B. Held

The_Sage said:
[...]
When the standard is ambigious, the standard is of no use.

You haven't shown any places where the standard *is* ambiguous.
If the authority wants to retain control, the authority had better
serve the people they represent instead of representing themselves.

The C++ committee pretty much does serve the people they
represent, since it is made up of the people they represent.
If the people want void main(),

Cite one other person besides yourself that "wants" "void main()".
So far, you are the only person I've met that has requested it
specifically. If it is so near and dear to you, you can do what
everyone else does, and write a proposal. I personally think it
would be amusing for the committee to take up your proposal
and discuss it.
then the standard should evolve with the people who use it,

I would say that standard is already considerably more evolved
than you. And it's barely old enough to enter kindergarten!
or the standard will become obsolete,

Actually, the standard already does become obsolete, but not
because of the decay you imply. Rather, it becomes obsolete
by the intentional actions of the committee, each time they update
it.
just like the authority will lose credibility.

Actually, the authority of the C++ committee has only increased
in credibility, as the industry moves to make their tools more and
more conforming to the standard.
Maybe your idea of an authority is a mirror image of Adolf Hitler
or Bill Gates,

While I can see a similarity between Hitler and Gates, I don't see
the relevance to C++. But if you're losing an argument badly,
and don't have anything else to lose, then throwing in a reference
to Hitler is usually a good tactic. The problem is that it's like tossing
a grenade...if you don't throw it fast enough, it blows up in your
face.
but thankfully people in general are learning to stand up to people
like that

All because of your championing the cause of the little guy! You're
my hero!!!
and think for themselves.

Unfortunately, when people like you "think for themselves", the result
gets a bit ugly.
Having a standard allows all of us to work together as a team, it
isn't supposed to be a way to manipulate people into doing the
will of the few.

So pretty much the vast majority of C++ programmers agree that
"int main()" is the way to go, and your "will" is that "void main()" is
or should be well-formed C++. I would say it's fair to say that you
are "the few". Put that way, who is the oppressive authority and who
is doing the manipulating?
[...]
Do you even have a clue what "but otherwise" means? In English?

Let me show you what you're doing:

[The Sage wrote:]
I...should evolve...or...like...Adolf Hitler...thankfully...Gates...
manipulate...the...English.

Now, as you can see, I quoted you, in the original word order, even.
Which means I can play your trick too, and make your words say
something they didn't originally. If you try to dispute my rendering,
I just say: "Do you know what 'should evolve' means?? In English?!?!"
And that counts as a "rebuttal". I admit, it's fun to do, but can't be
taken seriously by anyone who pretends to think.
It means you don't know what the heck you are talking about.
Blindly assert all you want that you are right and I am wrong,

Wow. This is so apropos, I could simply change the attribution,
and it would make even more sense.
it won't change the fact that it can be interpreted loosely in that
section,

You are the only one playing fast and loose with that section. You
can't muster one other person who agrees with your reading. On
the other hand, every other person in this thread, and the people
responsible for the very contents of the standard (including the
language inventor himself) have spelled it out for you in no uncertain
terms. You simply have no excuse, other than perhaps a pathological
ignorance.
and many of the major compiler manufacturers have choosen the
same interpretation as I have, not as you have.

Prove it. Prove that the compiler manufacturers have interpreted
the standard as you have. When I see a written statement from
any of them to this effect, I will concede the point.
Adapt or perish.

Physician, heal thyself.
[I said...]
Many major compilers are not conforming C++ implementations.

Not according to them or the standard, as it is currently worded.

Actually, it is according to the vendors themselves, and the
conformance tests which they run. Oh, you didnt' know there were
actual *tests* to measure conformance? Who would need that?
Aren't all the major compilers already conforming? Let's see...we
have the experts, the users who try to use conforming code in the
applications, but can't, the vendors, and now the conformance tests
all saying that virtually all of the major C++ implementations (and
certainly including the ones you named) are not conforming.

And then there is you.

What's wrong with this picture? If you are so right, why can't you
get one other person to agree with you? You have written tens of
posts arguing your position, and have persuaded nobody. How
could the truth be so utterly impossible to show to anyone else?
Could it be that...YOU'RE WRONG?
Argument by mantra isn't going to prove anything, except you have
no legitimate leg to stand on.

That's a wonderful statement. I think it applies perfectly to:

"'void main()' is legal C++"
[...]
The standard does conform to what the user needs.

And how did you determine that?

By reading in public forums like this one about how people are
using the language and seeing that they are doing a lot of cool
stuff with it. And where the standard does not meet all of the
users' needs, there are proposals written to possibly change it.
However, I'm not aware of a single proposal to make "void
main()" well-formed code, though there might be in the future.
[...]
And how does the standards committee determine what the
users need?

By considering proposals written by the users.
Certainly not by asking C++ users. I've never had an interview
with the standards committee.

That's because it's obvious that you don't use C++. When was
the last time a congressman asked you for an interview before
making new laws?
No one at my workplace has had an interview with the standards
committee. Who are they actually interviewing, if they are
interviewing at all?

They're "interviewing" those who submit proposals, just like
Congress has hearings for proposed bills. Novel idea, huh?
Besides, why would the C++ committee interview people
working at a marble factory?
Yes, it is what many compiler manufacturers and their users want.

Please cite the manufacturers and users expressing this desire, or
retract your claim. Also, that is not a "use-case". But it doesn't
suprise me in the least that you don't know what a use-case is.
But to be a little more specific, what is the point in returning an int
for main()?

To provide an exit code to be used by the hosting environment, of
course.
The only time that is going to do anything is if you exit the program
in DOS.

LOL!!! You embarrass yourself at every turn, and don't even realize
it! No self-respecting programmer would make a blunder of this
magnitude. I can only conclude that the shop you work at uses
VB on WinTel exclusively.
Then the program returns an DOS error code. Well guess what?
DOS is dead. It is obsolete. Returning anything at all is useless and
pointless for a standalone program anyway. That is what exception
handling is for.

LOL!!! This is so funny, I couldn't have embarrassed you more
myself if I tried!!! Obviously, you don't know what shell
programming is all about, you aren't familiar with *nix, and you
haven't got a clue what exception handling is. The idea that
exception handling has anything to do with exit codes is just
unbelievably funny!

Dave
 
G

Greg Comeau

...
So pretty much the vast majority of C++ programmers agree that
"int main()" is the way to go, and your "will" is that "void main()" is
or should be well-formed C++. I would say it's fair to say that you
are "the few". Put that way, who is the oppressive authority and who
is doing the manipulating?

Well, this might be about the only point he has.
That is to say, allowing "void main" has come up
in a number of newsgroups over the years. I even allude
to allowing it here http://tinyurl.com/owv4 as well
as other variation of main (T main(std::vector<std::string>...), etc)
 
N

Noah Roberts

Thanks for the summary, I didn't feel like reading the whole thing this
time; or even some of it actually.

NR
 
W

WW

Greg said:
Well, this might be about the only point he has.
That is to say, allowing "void main" has come up
in a number of newsgroups over the years. I even allude
to allowing it here http://tinyurl.com/owv4 as well
as other variation of main (T main(std::vector<std::string>...), etc)

IIRC C99 does allow it, explicitly. But C99 still lacks the standard
definition of: what then? It fails to address what the exit code will be.
Like if it is void the exit code is 0 unless you call exit() with something
else. Of course if the return type is SomeWeirdType it cannot be defined,
but for void it could. But it is not - today at least.
 
G

Greg Comeau

IIRC C99 does allow it, explicitly. But C99 still lacks the standard
definition of: what then? It fails to address what the exit code will be.
Like if it is void the exit code is 0 unless you call exit() with something
else. Of course if the return type is SomeWeirdType it cannot be defined,
but for void it could. But it is not - today at least.

Not in a strictly conforming, hosted environment situation it doesn't.
C90 does. Notwithstanding that, to me, allowing void main is
technically addressable, so that's not the issue. As it stands,
there are so many unstated et al things about exit, that void main
wouldn't interfere much, if at all, and when analyzed may actually
offer some sanity to it. Certainly int main.... is extraordinarily
limited, and also laced with many unstated things. So in the end,
this is all a mess anyway. And if it were allowed, then the aspects
of what it fails to address would certainly be touched on.
 
W

WW

Greg said:
Not in a strictly conforming, hosted environment situation it doesn't.
C90 does. Notwithstanding that, to me, allowing void main is
technically addressable, so that's not the issue. As it stands,
there are so many unstated et al things about exit, that void main
wouldn't interfere much, if at all, and when analyzed may actually
offer some sanity to it. Certainly int main.... is extraordinarily
limited, and also laced with many unstated things. So in the end,
this is all a mess anyway. And if it were allowed, then the aspects
of what it fails to address would certainly be touched on.

5.1.2.2.3 is confusing. Since it does not say that when it is syaing:

"If the return type is not compatible with int, the termination status
returned to the host environment is unspecified."

that it is talking about freestanding environment. Furtermore confusion is
added since it uses the term "host environment" - which suggests that C is
hosted.

5.1.2.2.1 also seems to give 3 choices for main, one of which is after a
semicolon and kinda suggests that whatever comes after it is about the whole
main function and not only the parameters. Espcially if we add 5.1.2.2.3
into the picture. The "or in some other implementation-defined manner" does
not suggest that it is talking only about the parameters, but about the
whole declaration. It could (IMO should if only int is valid) say: "or with
some other implementation-defined parameters".
 
G

Greg Comeau

5.1.2.2.3 is confusing. Since it does not say that when it is syaing:

"If the return type is not compatible with int, the termination status
returned to the host environment is unspecified."

that it is talking about freestanding environment. Furtermore confusion is
added since it uses the term "host environment" - which suggests that C is
hosted.

5.1.2.2.1 also seems to give 3 choices for main, one of which is after a
semicolon and kinda suggests that whatever comes after it is about the whole
main function and not only the parameters. Espcially if we add 5.1.2.2.3
into the picture. The "or in some other implementation-defined manner" does
not suggest that it is talking only about the parameters, but about the
whole declaration. It could (IMO should if only int is valid) say: "or with
some other implementation-defined parameters".

As I recall, and if I'm not mistaken, things in C99 boil down to:

1) Implementation-defined behavior requires a diagnostic
2) Termination in a free standing environment is i-d
3) 5.1.2.2.3 is confusing, but in light of the above,
it's a wash, and really is talking about a hosted environment,
since the free standing situation is already covered by (2).
So since otherwise it has also already defined things for a
hosted environment, it want to add another bit about when
the otherwise part is used in a hosted environment.
4) So that C is hosted makes sense, since that's the environment
the sentence is addressing, not the freestanding one.
5) I don't know what gained over the use of such, but
I think you're right that the semicolon makes it refer to the
whole function's type and not just parts.

These are not exactly the C++ rules.
 
W

WW

Greg Comeau wrote:
[SNIP]
As I recall, and if I'm not mistaken, things in C99 boil down to:

1) Implementation-defined behavior requires a diagnostic
2) Termination in a free standing environment is i-d
3) 5.1.2.2.3 is confusing, but in light of the above,
it's a wash, and really is talking about a hosted environment,
since the free standing situation is already covered by (2).
So since otherwise it has also already defined things for a
hosted environment, it want to add another bit about when
the otherwise part is used in a hosted environment.
4) So that C is hosted makes sense, since that's the environment
the sentence is addressing, not the freestanding one.
5) I don't know what gained over the use of such, but
I think you're right that the semicolon makes it refer to the
whole function's type and not just parts.

So it seems they have tried to rule out non-int... but finally they did not.

I wonder why didn't they define void. That would be soooo easy. Instead of
saying (in C++) return 0; one would say that it returns and calls exit(0);

For C99 it would be the same - and IMO it would make sense. Since the last
time I have checked void main in Intel environment (IIRC it was MS compiler)
it always returned (as exit code) whatever garbage happened to be in the AL
register.
These are not exactly the C++ rules.

Sure!
 
G

Greg Comeau

Greg Comeau wrote:
[SNIP]
As I recall, and if I'm not mistaken, things in C99 boil down to:

1) Implementation-defined behavior requires a diagnostic
2) Termination in a free standing environment is i-d
3) 5.1.2.2.3 is confusing, but in light of the above,
it's a wash, and really is talking about a hosted environment,
since the free standing situation is already covered by (2).
So since otherwise it has also already defined things for a
hosted environment, it want to add another bit about when
the otherwise part is used in a hosted environment.
4) So that C is hosted makes sense, since that's the environment
the sentence is addressing, not the freestanding one.
5) I don't know what gained over the use of such, but
I think you're right that the semicolon makes it refer to the
whole function's type and not just parts.

So it seems they have tried to rule out non-int... but finally they did not.

Heh. Um, no, they did rule it out for strictly conforming.
But then I guess felt compelled to offer more in other cases :)
I wonder why didn't they define void. That would be soooo easy.
Instead of saying (in C++) return 0; one would say that it returns
and calls exit(0);

As I said in my other post, it's probably quite possible to
define things soundly if "void main" were allowed.

I should note that the C99 Rationale states:

"main is the only function that may portably be declared
either with zero or two arguments. (The number of other
functions arguments must match exactly between invocation
and definition.) This special case SIMPLY RECOGNIZES THE
WIDESPREAD PRACTICE of leaving off the arguments to main
when the program does not access the program argument
strings. While many implementations support 10 more than
two arguments to main, such practice is neither blessed
nor forbidden by the Standard; a program that defines
main with three arguments is not strictly conforming
(see K.5.1.)."

Notice the boldphase emphasis I've added, as well as their
use of the work "simply" :) Anyway, my point is that
they did not feel compelled to comply recognize this one.

Of course, "void" was an invention that came about during
the process of the first C standard, and as C++ was evolving,
so the argument is that "void main" did not exist yet to add.
But something like this did and was widespread use already:

main()
{
}

Note lack of return type or return statement (or call to exit()).
Of course, this is considered sloppy coding so presents a
catch-22 situation at the time.
For C99 it would be the same - and IMO it would make sense. Since the last
time I have checked void main in Intel environment (IIRC it was MS compiler)
it always returned (as exit code) whatever garbage happened to be in the AL
register.

Sure. But if defined, it may even be able to return non-garbage.
Like I said, many aspects to preogram termination are messy, but
defining more parts could help, but of course, "void main" is
not a strictly conforming hosted thing. It might often be used
in an embedded system, where there is no host OS, or in some place
where there is no "place" to return too. Those semantics
could still be spelled out, but here we are. Of course,
a BIG argument against it is that if it were allowed, what
the hell would folks do with all their time instead of posting
thousands of messages about this over the decades?? :)
 
W

WW

Greg Comeau wrote:
[SNIP]
Heh. Um, no, they did rule it out for strictly conforming.
But then I guess felt compelled to offer more in other cases :)

I see. But troll have real bases to call that part ambiguous. Especially
since first it wants to say: don't do it, then it says: but if you do... ;-)
As I said in my other post, it's probably quite possible to
define things soundly if "void main" were allowed.
Yep.

main() { }

Yeah. It *is* sloppy.
Sure. But if defined, it may even be able to return non-garbage.

That is what I have meant. I was just listing that saying it has to be
exit(0) would avoid ugly things like the pseudo-random exit code.
Like I said, many aspects to preogram termination are messy, but
defining more parts could help, but of course, "void main" is
not a strictly conforming hosted thing.

OK. The C99 standard could be more clear about it. :)
It might often be used
in an embedded system, where there is no host OS, or in some place
where there is no "place" to return to.
Those semantics could still be spelled out, but here we are.

Yep. Not that it is paramount importance, but it (unfortunately) widespead
(mal)practice.
Of course,
a BIG argument against it is that if it were allowed, what
the hell would folks do with all their time instead of posting
thousands of messages about this over the decades?? :)

Yeah. And I would loose all my firm C++ knowledge in an instance. :)
 
G

Greg Comeau

Greg Comeau wrote:
[SNIP]
Heh. Um, no, they did rule it out for strictly conforming.
But then I guess felt compelled to offer more in other cases :)

I see. But troll have real bases to call that part ambiguous. Especially
since first it wants to say: don't do it, then it says: but if you do... ;-)

It requires careful reading, that's for certain.
That is what I have meant. I was just listing that saying it has to be
exit(0) would avoid ugly things like the pseudo-random exit code.

Or something like: if used, the implemention defined equivalent of
exit(EXIT_SUCCESS), whether it actually calls exit or not.
 
W

WW

Greg Comeau wrote:
[SNIP]
Or something like: if used, the implemention defined equivalent of
exit(EXIT_SUCCESS), whether it actually calls exit or not.

Yep. I like that better. I wanted to write something similar... but my
English...

(BTW did your mail mean you don't want to look at that proposal?)
 
B

Beth

The_Sage said:
Obviously english isn't your first language. The ISO standard uses the "but" in
a proper form, as in "You are required to attend but you are allowed to bring
someone else if you like".

Actually, English is ambiguous here (as it also is with "or")...using
German to compare against, English "but" can be "sondern" or
"aber"...that is, it can be opposing ("I can do this BUT I can't do
that") or complimentary ("I can do this but John thinks he does it
better"...John's thoughts are not opposing but "lateral" to the main
clause)...

This is similar to how English does not have unambiguous semantics for
the word "or" either...hence, why programmers and engineers use
"inclusive OR" and "exclusive OR" to cover the two possibilities that
"or" could mean in English..."but" is a similar word in that it
actually carries two possible logical meanings that aren't quite the
same but close enough that no-one cares and context usually make the
distinction...in German, though - which was why I used that as a
comparative example - the two are disambiguated by separate words:
"sondern" (opposing "but") and "aber" (lateral "but")...hence, if you
want it unambiguous then you should use "however" or "whereas" or
something similar rather than "but" because its semantics are too
loose and potentially logically ambiguous...

Beth :)
 
B

Beth

David said:
Bringing someone else doesn't alter the fact that you must still attend,
just as an implementation's defining the type of 'main' doesn't alter the
fact that it still must return int. You seem to be agreeing that 'main' must
return int.

Indeed, this example from Sage doesn't prove his point at all...you're
absolutely right, that this is an "aber" (lateral clause) usage, not a
"sondern" (opposing clause)usage...the clause after the "but" is NOT
opposing (you must still attend regardless of bringing someone else)
so it's not the "proper form" he talks about (although, he's totally
wrong about it being any sort of "proper form", anyway..._both_ usages
of "but" are "proper" in English...it's just the word itself is
ambiguous...very much akin to how "or" can be either "inclusive or" or
"exclusive or"...which is why logic - which has to be pedantic with
only a single meaning - chooses to refer to them as "inclusive or" and
"exclusive or" to remove the potential ambiguity that the loose
English semantics carry..."but" is an entirely similar word in this
context in English)...

Oh, don't worry...have you seen the state of the Sage's English in
many of his posts? And that's without going anywhere near his complete
inability to grasp even basic principles of logical thought...take it
as a compliment because whenever the Sage thinks someone is "wrong"
that just tends to mean that you're perfectly accurate and it's one of
the many, many things that just flies straight over his head because
he's not able to comprehend basic English or logic...

Beth :)
 
B

Beth

Attila said:
He does not even understand English. How do you think he could spell. He
has no idea that otherwise might also mean "from any other respect, but the
ones mentioned so far". Poor guy.

"But" being in an opposing clause form ("sondern") in this instance,
of course, that "otherwise" means roughly "in the case of everything
else that has not yet been covered" (no overlap permitted with
"sondern"...otherwise, the "aber" form _can_ potentially overlap
because the clause is not meant to be opposing...merely additional
:)...

That's the Sage's first mistake...he thinks he can be highly
pedantical with precise logic and still use the English
language...indeed, poor guy...he has no idea just how much of a mess
his secondary tongue can be (well, it just can't be his mother tongue
with the awful, pathetic use he makes of it...if it _is_ his mother
tongue, then he should immediately sue his schools and teachers which
left him with such a serious mental disadvantage, as this level of
miseducation is nigh-on criminal ;)...

Beth :)
 
B

Beth

David said:
While I can see a similarity between Hitler and Gates, I don't see
the relevance to C++. But if you're losing an argument badly,
and don't have anything else to lose, then throwing in a reference
to Hitler is usually a good tactic. The problem is that it's like tossing
a grenade...if you don't throw it fast enough, it blows up in your
face.

Cool...he's invoked Godwin's law...mentioning Hitler is as good as
using the word "Nazi" and, by the law, this should kill the thread
dead soon enough :)

Beth :)
 
B

Beth

Attila said:
to

Please stop bringing this thread up. Thank you.

Okay, fine...I attempted to do you good service - in good Faith -
here...and I _exactly_ called the numbers correctly, as the Sage _DID_
return...and, as predicted, everyone's still replying to him and the
thread is flying out of control to haunt the groups for weeks...

But if you choose to be abruptly rude to those who only seek to do you
good service in totally good Faith then, basically, in the politest
possible sense, screw you...may you drown in the Sage's posts...and,
oh yeah, he _will_ just keep going until you finally take my advice:

"The only way to win, is to deny the battle"

The ball is in your court...though, I will say that I'm thoroughly
disappointed in this ignorant and rude response from you because I had
thought you a thoroughly likeable person up until this point...but
this was entirely uncalled for because my sole purpose here was to try
to get everyone up to speed with the troll so as to deal with him
appropriately before what has actually happened, exactly as I
predicted it would...

Fine, I'm gone...no-one seems to be listening, anyway, as they just
keep on feeding the troll with the insatiable appetite...so, fine, be
rude and ignore me...I was only trying to help but if the help is not
appreciated then, simply, the consequences will be on your heads...

Beth :)
 
B

Beth

Duane said:
This guy is just trolling and apparently very successfully.

Yes; And that's why I posted to this thread to attempt to bring
everyone up to speed that, with this troll, you just don't _ever_
induldge him anything whatsoever...well, at least as I leave the
thread upset at being told rudely to "piss off", just for predicting
_exactly what happened_ that he'd return and presuade otherwise
sensible people to respond to what is clearly either serious insanity
or highly developed trolling techniques...at least I get the pleasure
in the ultimate childish victory:

_Told you so_

Beth ;)
 

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,145
Messages
2,570,826
Members
47,371
Latest member
Brkaa

Latest Threads

Top