int main()?

J

Jonathan Pritchard

Hi,

This is my first Usenet post so forgive me, and please point out any
mistakes I make.

Not sure if Thunderbird is a good news reader.

I've just been starting to learn C, coming from a background of a year
in Pascal and Delphi.

Looking through code examples and working through K&R Second Edition,
I'm confused as to why sometimes people use:

int main()
{

}

Whereas in the book, they just use:

main()
{

}

Thank-you in advance
 
F

Flash Gordon

Jonathan said:
Hi,

This is my first Usenet post so forgive me, and please point out any
mistakes I make.

You can be sure that people will ;-)
Seriously, people who want to do the right thing are very welcome. Given
the attitude of wanting to learn and wanting to behave "correctly"
ignorance and mistakes will be quickly forgiven and forgotten.
Not sure if Thunderbird is a good news reader.

It's what I use so you can guess my opinion.
I've just been starting to learn C, coming from a background of a year
in Pascal and Delphi.

Looking through code examples and working through K&R Second Edition,

An excellent book although not perfect. You should look at the official
errata available from http://cm.bell-labs.com/cm/cs/cbook/2ediffs.html
I'm confused as to why sometimes people use:

int main()
{

}

Whereas in the book, they just use:

main()
{

}

Many people, especially around here, preffer
int main(void)
{
}

There are a couple of reasons.

Being explicit is generally a good thing and specifying a void parameter
list forces the compiler to complain if you try to recursively call main
passing parameters.

Implicit int (i.e. the compiler assuming a type of int if nothing was
specified) has been dropped from the latest C standard making "main()"
invalid. The latest C standard is, unfortunately, not commonly
implemented but there is still no point in being incompatible with it
when there is not significant benefit to be gained.
 
C

Christopher Benson-Manica

Jonathan Pritchard said:
This is my first Usenet post so forgive me, and please point out any
mistakes I make.

You've done a lot better than most :)
Not sure if Thunderbird is a good news reader.

It works, and in any case is a much better choice than Google's broken
interface or LookOutExpress.
Looking through code examples and working through K&R Second Edition,
I'm confused as to why sometimes people use:

(This isn't directly relevant to your question, but you would do very
well to read the C FAQ at http://c-faq.com, and you might find 11.12a
to be of interest - http://c-faq.com/ansi/maindecl.html.)
int main()

Flash discussed the difference between this and

int main(void)

although I don't believe he mentioned that

is valid under the C89 standard (which allowed implicit int), but not
under the C99 standard (which does not).
 
S

Spiros Bousbouras

Christopher said:
You've done a lot better than most :)


It works, and in any case is a much better choice than Google's broken
interface or LookOutExpress.

In what way is Google's interface broken ?
 
F

Flash Gordon

Christopher Benson-Manica wrote:

Flash discussed the difference between this and

int main(void)

although I don't believe he mentioned that


is valid under the C89 standard (which allowed implicit int), but not
under the C99 standard (which does not).

I didn't mention C89/C99 by name, but I did say that the latest C
standard had dropped implicit int making main() invalid. However, if you
missed it the OP might have as well, so it bears repeating.
 
C

Christopher Benson-Manica

Spiros Bousbouras said:
In what way is Google's interface broken ?

Unless things have changed (they may have, now that I think about it),
the obvious "Reply" button omitted all context and required the poster
to find a different "Reply" button to retain the context correctly.
Not to mention Google has neither signatures nor killfiles.
 
S

Spiros Bousbouras

Christopher said:
Unless things have changed (they may have, now that I think about it),
the obvious "Reply" button omitted all context and required the poster
to find a different "Reply" button to retain the context correctly.

This has been fixed for some time now.
Not to mention Google has neither signatures nor killfiles.

Lack of features does not equal "broken". And I'm not
sure about signatures.
 
J

Jonathan Pritchard

Spiros said:
This has been fixed for some time now.


Lack of features does not equal "broken". And I'm not
sure about signatures.

But lack of a major feature does. I remember many complaints coming from
people in the Mozilla community about Google Groups.

It's a usability issue.
 
J

jmcgill

Jonathan said:
But lack of a major feature does. I remember many complaints coming from
people in the Mozilla community about Google Groups.

It's a usability issue.

It shows a lack of awareness of how unmanageable USENET is with it's
poor SNR. But as much as I like Thunderbird, I'm finding it to be
nowhere near thorough enough in the killfile department either.

I was a trn user, but at some point the traffic reached a level where
processing my killfiles took more time than I actually had for dealing
with news.
 
D

Default User

Christopher said:
Unless things have changed (they may have, now that I think about it),
the obvious "Reply" button omitted all context and required the poster
to find a different "Reply" button to retain the context correctly.


That's been fixed for some time. That's why the Google problem has
shifted from no-quotes to top-posting :)





Brian
 
D

Default User

jmcgill said:
It shows a lack of awareness of how unmanageable USENET is with it's
poor SNR. But as much as I like Thunderbird, I'm finding it to be
nowhere near thorough enough in the killfile department either.

I looked at Thunderbird a bit when I was changing newsreaders.
Generally, it's filtering ability wasn't much better than Netscape's
had been. Like you, I'd gotten to the point where I needed better
filtering for all the junk and cross-posting whackos.

A couple fit the bill, I went with XanaNews because I liked the user
interface. XNews has one of the more powerful filtering mechanisms, but
I didn't care for the look and feel.




Brian
 
C

CBFalconer

Christopher said:
Unless things have changed (they may have, now that I think about
it), the obvious "Reply" button omitted all context and required
the poster to find a different "Reply" button to retain the
context correctly. Not to mention Google has neither signatures
nor killfiles.

In addition it mangles article content, doesn't keep track of read
articles for you, doesn't handle attachments on groups that allow
them, fails to handle cross-posts (and I believe follow-ups)
correctly. Just try a real newsreader and newsserver, and the
difference will be obvious. The old deja-news interface was much
better, so it is not just because of the inefficient html
communications.
 

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,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top