Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Re: Big Deal with returning int

Reply
Thread Tools

Re: Big Deal with returning int

 
 
Jerry Coffin
Guest
Posts: n/a
 
      06-30-2003
In article <(E-Mail Removed)>,
http://www.velocityreviews.com/forums/(E-Mail Removed) says...

[ ... ]

> >It's quite interesting that you call "void main" common practise, since
> >it actually never was allowed. So you think the rule should be changed,
> >because nobody follows it anyway?

>
> Misspelling "practice" shows that you do not know English very well.


My dictionary gives both "practice" and "practise" as proper spellings.

> If you do not have English mastered why should we trust your C++
> abilities?


Mastery of English is not a necessary to mastery of C++. Given the
ignorance of English you displayed above, you might be thankful for this
particular fact, since it prevents your programming ability from being
dismissed out of hand.

--
Later,
Jerry.

The universe is a figment of its own imagination.
 
Reply With Quote
 
 
 
 
John Harrison
Guest
Posts: n/a
 
      06-30-2003
>
> Actually there's a very good reason for standard C and C++ not to
> include "void main()".
>
> A spoken language like English (or French, or Russian, or Hindi, or
> any other) grows and evolves through common use. In cases like this,
> things that were originally ungrammatical can, do, and should become
> part of the language if that's what a large enough percentage of the
> speakers use.
>
> Computer languages, on the other hand, do not, and should not have
> that flexibility. If they grow and evolve, it should be through
> careful experimentation and adoption of useful, tested and verified
> existing practice. Not just rewarding the lazy and ignorant by
> codifying their laziness and/or ignorance.


Rewarding? That's an odd term to use, this isn't a moral debate. Adoption of
existing practise is exactly the point I'm making.

>
> What does C++ or C gain by standardizing "void main()"?
>


Legitimising common practise, at absolutely no cost that I can see. Nothing
else.

I'm not suggesting that the stadnards committe should change the standard
now, that would obviously be stupid. I'm just wondering why they didn't
then. Or the C standards committee either.

To return to the OP's question, 'what's the big deal?'. The big deal is that
this trivial issue annoys a lot of people for reasons I fail to understand.

Anyway I'm bored of this, I'd no intention of annoying so many people. Nor
did I think my perfectly reasonable POV would be so objected to.

john


 
Reply With Quote
 
 
 
 
Rolf Magnus
Guest
Posts: n/a
 
      06-30-2003
Alexander Terekhov wrote:

>
> Jack Klein wrote:
> [...]
>> What does C++ or C gain by standardizing "void main()"?

>
> C aside for a moment, C++ would gain "a lot" by standardizing
> "<whatever> main()".


And what would that "lot" be?

 
Reply With Quote
 
Rolf Magnus
Guest
Posts: n/a
 
      06-30-2003
Jerry Coffin wrote:

> My dictionary gives both "practice" and "practise" as proper
> spellings.


Mine showed that "practice" is the noun, while "practise" is (in British
English) the verb.

 
Reply With Quote
 
Alexander Terekhov
Guest
Posts: n/a
 
      06-30-2003

Rolf Magnus wrote:
>
> Alexander Terekhov wrote:
>
> >
> > Jack Klein wrote:
> > [...]
> >> What does C++ or C gain by standardizing "void main()"?

> >
> > C aside for a moment, C++ would gain "a lot" by standardizing
> > "<whatever> main()".

>
> And what would that "lot" be?


Here's an illustration:

http://groups.google.com/groups?thre...87D1C%40web.de
(Subject: Re: Why int main()?)

#include <thread>
#include <string>
#include <iostream>

typedef std::joinable_thread_ptr<std::string> main_thread_ptr;

void f(main_thread_ptr mtp) {
main_thread_ptr::join_t result = mtp->cancel().join();
const char * msg = std::thread_canceled(result) ?
"canceled" : result->c_str();
std::cout << msg << std::endl;
}

std::string main() {
std::new_thread(&f, main_thread_ptr(std::thread_self()));
std::thread_testcancel();
std::thread_exit(std::string("hello world"));
// Never reach here
return "";
}

that's "a lot", oder?

Well, given that void main() would also be legal [and it does make
sense to have void main()], it would save A LOT of bandwidth and
time on this newsgroup... to begin with. That's for sure.

regards,
alexander.
 
Reply With Quote
 
Karl Heinz Buchegger
Guest
Posts: n/a
 
      06-30-2003


Dill Hole wrote:
>
> On Sun, 29 Jun 2003 13:59:15 +0200, Rolf Magnus <(E-Mail Removed)>
> wrote:
>
> >I see it a bit different. If an author uses void main, that shows that
> >he doesn't know C++ very well. This gives not much trust in the rest of
> >the book.
> >
> >
> >It's quite interesting that you call "void main" common practise, since
> >it actually never was allowed. So you think the rule should be changed,
> >because nobody follows it anyway?

>
> Misspelling "practice" shows that you do not know English very well.
> If you do not have English mastered why should we trust your C++
> abilities?


Come back if you can read, write and speek german in a way
comparable to Rolf's english skills.
Until then, go away.

Thank you.

--
Karl Heinz Buchegger
(E-Mail Removed)
 
Reply With Quote
 
Jerry Coffin
Guest
Posts: n/a
 
      06-30-2003
In article <bdp4f7$n5g$03$(E-Mail Removed)-online.com>, (E-Mail Removed)
says...
> Jerry Coffin wrote:
>
> > My dictionary gives both "practice" and "practise" as proper
> > spellings.

>
> Mine showed that "practice" is the noun, while "practise" is (in British
> English) the verb.


Admittedly, I'm using a rather larger dictionary than most (not to
mention a rather elderly one) but it lists practice as both a noun and a
verb. It lists practise as a verb, but the last time I noticed, verbals
(e.g. gerunds) were still considered grammatical, so using a word that's
listed as a verb in a noun-like situation isn't necessarily a
grammatical error. Offhand, I no longer remember whether the original
use looked like a gerund or not, but the dictionary does list a
participle form for practise, which would at least allow the
possibility.

--
Later,
Jerry.

The universe is a figment of its own imagination.
 
Reply With Quote
 
Andre Kostur
Guest
Posts: n/a
 
      06-30-2003
Alexander Terekhov <(E-Mail Removed)> wrote in news:3F001F83.96AF652
@web.de:

>
> Rolf Magnus wrote:
>>
>> Alexander Terekhov wrote:
>>
>> >
>> > Jack Klein wrote:
>> > [...]
>> >> What does C++ or C gain by standardizing "void main()"?
>> >
>> > C aside for a moment, C++ would gain "a lot" by standardizing
>> > "<whatever> main()".

>>
>> And what would that "lot" be?

>
> Here's an illustration:
>
> http://groups.google.com/groups?thre...87D1C%40web.de
> (Subject: Re: Why int main()?)
>
> #include <thread>
> #include <string>
> #include <iostream>
>
> typedef std::joinable_thread_ptr<std::string> main_thread_ptr;
>
> void f(main_thread_ptr mtp) {
> main_thread_ptr::join_t result = mtp->cancel().join();
> const char * msg = std::thread_canceled(result) ?
> "canceled" : result->c_str();
> std::cout << msg << std::endl;
> }
>
> std::string main() {
> std::new_thread(&f, main_thread_ptr(std::thread_self()));
> std::thread_testcancel();
> std::thread_exit(std::string("hello world"));
> // Never reach here
> return "";
> }
>
> that's "a lot", oder?


That places a lot of burden on every OS that this application would need
to run on. Since your application needs to return a std::string to the
OS, which implementation of std::string should the OS expect? STLport?
Dinkumware? The Kostur STL? How about this main() :

MyOwnWeirdClass main()
{
return MyOwnWeirdClass();
}

What's the OS going to do with _that_ return value? It has no hope of
knowing what the heck is in that class, so there's not a whole lot that
it can do with it (intelligently...).

(Keep in mind that threading isn't defined in Standard C++, thus is not a
good basis for argument in this forum)

> Well, given that void main() would also be legal [and it does make
> sense to have void main()], it would save A LOT of bandwidth and
> time on this newsgroup... to begin with. That's for sure.
>
> regards,
> alexander.
>


 
Reply With Quote
 
Default User
Guest
Posts: n/a
 
      06-30-2003


John Harrison wrote:

> That's a gem of a circular argument. void main is illegal, therefore the
> compiler needn't compile it, therefore we can't allow void main.



That's not circular at all, it's linear. void main is illegal IN THE
STANDARD, so a compiler needn't compile it, so we (comp.lang.c++) can't
allow void main. Where is the circularity? There is none.



Brian Rodenborn
 
Reply With Quote
 
Alexander Terekhov
Guest
Posts: n/a
 
      06-30-2003

Andre Kostur wrote:
[...]
> > std::string main() {
> > std::new_thread(&f, main_thread_ptr(std::thread_self()));
> > std::thread_testcancel();
> > std::thread_exit(std::string("hello world"));
> > // Never reach here
> > return "";
> > }
> >
> > that's "a lot", oder?

>
> That places a lot of burden on every OS that this application would need
> to run on. Since your application needs to return a std::string to the
> OS, ....


It isn't meant to return "a std::string to the OS". Try again.
Slowly, this time. That program uses a "passive exit"... that
returns int(0) "to the OS".

regards,
alexander.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Big Deal with returning int Jonathan Clements C++ 7 07-01-2003 04:42 PM
Re: Big Deal with returning int John Harrison C++ 5 06-30-2003 12:06 PM
Re: Big Deal with returning int Samuele Armondi C++ 0 06-29-2003 04:21 PM
Re: Big Deal with returning int Rolf Magnus C++ 0 06-29-2003 11:47 AM
Re: Big Deal with returning int Ian C++ 0 06-29-2003 07:29 AM



Advertisments