473,785 Members | 2,369 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

FAQ incorrect?

In the faq for this group:

Q: What's the correct declaration of main()?

A: There are two valid declarations:

int main(void)
int main(int argc, char **argv)

although they can be written in a variety of ways. The second parameter
may be declared char *argv[] (see question 6.4), you can use any names
for the two parameters, and you can use old-style syntax:

int main()

int main(argc, argv)
int argc; char **argv;

.......... http://c-faq.com/ansi/maindecl.html

The way this is worded it makes one think that "int main()" is a valid
declaration of main. However, main is allowed to only take two params
of (int, char **) or 0, correct? In C is not an empty param list an
"unspecifie d" param list? In that case "int main()" would be invalid
as it matches neither of the standard signatures.

Another faq claiming to represent this group has the following text for
the same Q:

A: Either int main(), int main(void), or int main(int argc,
char *argv[]) (with alternate spellings of argc and *argv[]
obviously allowed). See also questions 11.12b to 11.15 below.

References: ISO Sec. 5.1.2.2.1, Sec. G.5.1; H&S Sec. 20.1 p.
416; CT&P Sec. 3.10 pp. 50-51.

............... http://www.faqs.org/faqs/C-faq/faq/

It also has "int main()" but has no reasoning for its validity except
ref to the std I don't have access to. Is that truely a valid
signature? I always thought you _needed_ (void).

Aug 4 '06
49 1709
In article <sl************ **********@loca lhost.localdoma in>,
Andrew Poelstra <ap*******@fals e.sitewrote:
>On 2006-08-04, nroberts <ro**********@g mail.comwrote:
>>
Kenny McCormack wrote:
>>Really, you need to re-think that post or you may lose your place in the
he-man newbie-hating society.

Hehehe...alway s interesting how one can inadvertently stir up a bee's
nest...

If by `one' you mean yourself, you did nothing wrong. If by `one' you
mean McCormack, it wasn't inadvertent. He's a troll, and it's best you
don't respond to his deranged mutterings.
Pot, kettle, black.

Aug 4 '06 #11
Richard Heathfield wrote:
jacob navia said:
>>Walter Roberson wrote:

<snip>
>>>According to C89 3.5.4.3,

[snip]

Irrelevant since that standard is no longer valid.


It's perfectly valid according to a large number of compilers that support
it and a huge number of programmers who use it. If we were to consider C89
as invalid, then we would have no valid, widely-implemented C standard,
which would be a ridiculous state of affairs.
OK OK.

When I bring a large number of compilers in many OSes
that support

#pragma once

you tell me that it is non-standard.

When I say that the standard is now

int main(void or int main(int argc,char *argv[])

you start with a large number of compilers that support C89.

There are many compilers that support the K&R standard (without
prototypes).

Should we recommned new users that they use that?

Let's standardize in the standard we use: :-)

The *current* standard.

The rest is HISTORICAL and just confuses people
Aug 4 '06 #12
jacob navia said:
Richard Heathfield wrote:
>jacob navia said:
>>>Walter Roberson wrote:

<snip>
>>>>According to C89 3.5.4.3,

[snip]

Irrelevant since that standard is no longer valid.


It's perfectly valid according to a large number of compilers that
support it and a huge number of programmers who use it. If we were to
consider C89 as invalid, then we would have no valid, widely-implemented
C standard, which would be a ridiculous state of affairs.

OK OK.

When I bring a large number of compilers in many OSes
that support

#pragma once

you tell me that it is non-standard.
But your idea of "large number" is a relatively small number, whereas the
number of compilers conforming to C89 is considerably greater. In fact,
you'd be hard-pressed to find a C compiler in current use that did not
conform to C89 (modulo the odd bug), whereas it is so easy to find a C
compiler that does not support #pragma once that you managed it all by
yourself.
When I say that the standard is now

int main(void or int main(int argc,char *argv[])
you'd be wrong, because the first of your examples is a parenthesis short of
a declarator.
you start with a large number of compilers that support C89.
Indeed. Note that int main(void) and int main(int argc, char *argv[]) or
their equivalents have been the forms recommended by clc for many years, so
I don't see what point you're trying to make here.
There are many compilers that support the K&R standard (without
prototypes).
Sure. Whilst they do not conform to C89 (at least, when invoked in K&R
mode), they nevertheless may prove useful to some people. K&R C is still
topical here.
Should we recommned new users that they use that?
Only if they are obliged to use K&R compilers.
Let's standardize in the standard we use: :-)
It's not up to you and me to determine which flavours of C are topical here.
By longstanding convention, K&R C, C90, and now C99 are all topical in clc.
The *current* standard.
Fine, as soon as it becomes as widely implemented as C90 currently is, which
won't be for many years.
The rest is HISTORICAL and just confuses people
The kind of people who make good computer programmers are not the kind of
people to be confused easily by the fact that a newsgroup might discuss K&R
C, C90, /and/ C99.

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at above domain (but drop the www, obviously)
Aug 4 '06 #13

Troll Alert: Kenny McCormack

The only way to deal with trolls is to limit your reaction to reminding
others not to respond to trolls.

--

Frederick Gotham
Aug 4 '06 #14

Troll Alert: Kenny McCormack

The only way to deal with trolls is to limit your reaction to reminding
others not to respond to trolls.

--

Frederick Gotham
Aug 4 '06 #15
jacob navia <ja***@jacob.re mcomp.frwrites:
Richard Heathfield wrote:
>jacob navia said:
>>>Walter Roberson wrote:
<snip>
>>>>According to C89 3.5.4.3,

[snip]

Irrelevant since that standard is no longer valid.
It's perfectly valid according to a large number of compilers that
support it and a huge number of programmers who use it. If we were
to consider C89 as invalid, then we would have no valid,
widely-implemented C standard, which would be a ridiculous state of
affairs.

OK OK.

When I bring a large number of compilers in many OSes
that support

#pragma once

you tell me that it is non-standard.
Yes, because it is.
When I say that the standard is now

int main(void or int main(int argc,char *argv[])

you start with a large number of compilers that support C89.
I don't see your point here; that didn't change between C89 and C99
(except for C99's explicit permission to have more
implementation-defined forms, but extensions were already permitted).
There are many compilers that support the K&R standard (without
prototypes).

Should we recommned new users that they use that?
Of course not. There are few C compilers still in common use that
don't support at least the C89/C90 standard reasonably well. There
are even fewer platforms still in common use that don't have at least
*some* compiler that supports at least the C89/C90 standard, even if
the native compiler doesn't. There is no longer very much point in
worrying about pre-C89 compilers. On the other hand, if any users run
into a situation where they need to program in C on a system with no
modern compiler available, yes, this would be the place to ask for
advice.
Let's standardize in the standard we use: :-)

The *current* standard.

The rest is HISTORICAL and just confuses people
One more time. The full C89/C90 standard is widely implemented. The
C99 standard is not. Not everyone uses, or is able to use, the C99
standard. Even your own lcc-win32 doesn't implement all of it. That
is reality.

Will you, just once, *acknowledge* that plain fact? Or will you
continue to deny reality and make a fool of yourself? (I think I
already know the answer, but I'm always prepared to be pleasantly
surprised.)

--
Keith Thompson (The_Other_Keit h) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <* <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Aug 4 '06 #16
In article <oS************ *******@news.in digo.ie>,
Frederick Gotham <fg*******@SPAM .comwrote:
>
Troll Alert: Kenny McCormack
Pot. Kettle. Black.

Aug 4 '06 #17

The only way to deal with trolls is to limit your reaction to reminding
others not to respond to trolls.

--

Frederick Gotham
Aug 5 '06 #18
Frederick Gotham <fg*******@SPAM .comwrites:
The only way to deal with trolls is to limit your reaction to reminding
others not to respond to trolls.
Yes, we know.

Usually someone posts a single followup to anyone who responds to the
troll in question, and that generally works reasonably well. Starting
a new thread gives the troll more attention.

--
Keith Thompson (The_Other_Keit h) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <* <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Aug 5 '06 #19
On Fri, 04 Aug 2006 18:38:18 +0200, jacob navia
<ja***@jacob.re mcomp.frwrote in comp.lang.c:
Walter Roberson wrote:
In article <11************ *********@b28g2 000cwb.googlegr oups.com>,
nroberts <ro**********@g mail.comwrote:
>In the faq for this group:
>Q: What's the correct declaration of main()?
>for the two parameters, and you can use old-style syntax:
> int main()
>The way this is worded it makes one think that "int main()" is a valid
declaration of main.

It is.

>However, main is allowed to only take two params
of (int, char **) or 0, correct? In C is not an empty param list an
"unspecified " param list?

According to C89 3.5.4.3,

[snip]

Irrelevant since that standard is no longer valid.
Jacob, you're getting to be a real PITA. Since the text is
essentially the same in the current standard, it makes no real
difference.

--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://c-faq.com/
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.l earn.c-c++
http://www.contrib.andrew.cmu.edu/~a...FAQ-acllc.html
Aug 5 '06 #20

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
14400
by: Michelle Hillard | last post by:
Hi guys, would appreciate if you can shed some light on this. Sorry to be a pain, can you tell me what is wrong with the following: for /F %%i in ('dir /b /on c:\bcp\pc*.txt') do bcp Inventory..pc in %%i -fc:\bcp\bcp.fmt -T -S CHICKYy where CHICKYy is the server bcp.fmt
2
1280
by: Linda Wienholt | last post by:
I have two usercontrols on the home page of my website. They are intermitently sending incorrect HTML to the browser, which results in a textbox being rendered with the wrong width. Either both controls render correctly or both are incorrect but never a mixture. When they are rendered correctly the source looks like <input name="Header2:txtKeyword" type="text" id="Header2_txtKeyword" style="width:80px;" / When incorrect the source looks...
1
3931
by: murphy | last post by:
Hi, I've been seeing two symptoms with my asp.net site that have started recently after a long period of smooth running. As others on our team make changes to referenced dll's I find that I get the following errors from time to time. Apparently the following procedure alleviates the problems: -Reboot (clears locks on following directory)
3
3350
by: murphy | last post by:
Hi, I've been seeing two symptoms with my asp.net site that have started recently after a long period of smooth running. As others on our team make changes to referenced dll's I find that I get the following errors from time to time. Apparently the following procedure alleviates the problems:
4
2757
by: Peter Ritchie | last post by:
Does anyone know how to suppress a specific warning for a line or block of code in C#? C++ has a nice facility to disable a warning for a block of code with #pragma for warnings that are incorrect or don't apply. For example, the following code generates an CS0628 because CS0628 makes an incorrect assumption that "protected" applies only to inheritance: public sealed class Class { EmbeddedClass utility = new EmbeddedClass();
6
2648
by: ypjofficial | last post by:
HI, I have following terrific confusion. class test { public: int i; int * j; int **k;
2
4858
by: mankolele | last post by:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Simple Database Connection</title> </head> <body bgcolor="white"> <?php $connection = mysql_connect("localhost", "root", "phpmysql"); $select_db = mysql_select_db("procdumy", $connection);
6
8600
by: trevor | last post by:
Incorrect values when using float.Parse(string) I have discovered a problem with float.Parse(string) not getting values exactly correct in some circumstances(CSV file source) but in very similar circumstances(XML file source) and with exactly the same value it gets it perfectly correct all the time. These are the results I got, XML is always correct, CSV are only incorrect for some of the values (above about 0.01) but always gives the...
1
2405
by: ndawg123 | last post by:
Hey guys what im trying to do is write a yatzee game with C. And im stuck already and its the start?!?! I want the user to type there 5 numbers. i.e My program so far does this Please enter dice Values:
0
8330
by: roamnet | last post by:
hi i created database file with .mdf extention ,sql server as a source and use grid view to display data there're no problem in data retrieve and display,but i want to edit it or insert new records there is an error "Incorrect syntax near '-'. Must declare the scalar variable "@UserName". I worked out in design view,code is automatically generated.Iam not able fix the error. Iam working with Visual Web Developer-2005 Express Edition
0
9645
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9481
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10155
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10095
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7502
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6741
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5383
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3656
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2881
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.