* Re: First Basic Program
@ 2003-02-25 3:12 Dockeen
2003-02-25 23:02 ` Samuel T. Santos
2003-03-04 6:21 ` LLeweLLyn Reese
0 siblings, 2 replies; 17+ messages in thread
From: Dockeen @ 2003-02-25 3:12 UTC (permalink / raw)
To: gcc-help
Actually I have seen a number of folks argue with
great vitriol that void main() is *really* the right
way, usually based on history and that "life is
different than standards" or the ever favorite,
"programming to standards is industrial and I don't
teach that in my classroom, and never will"
Wayne
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: First Basic Program
2003-02-25 3:12 First Basic Program Dockeen
@ 2003-02-25 23:02 ` Samuel T. Santos
2003-03-04 6:21 ` LLeweLLyn Reese
1 sibling, 0 replies; 17+ messages in thread
From: Samuel T. Santos @ 2003-02-25 23:02 UTC (permalink / raw)
To: GCC-Help
yeah... My professor is one of that
I prefer follow the standards... and know the possibilities
til next
Sams
Em Ter, 2003-02-25 às 00:11, Dockeen escreveu:
> Actually I have seen a number of folks argue with
> great vitriol that void main() is *really* the right
> way, usually based on history and that "life is
> different than standards" or the ever favorite,
> "programming to standards is industrial and I don't
> teach that in my classroom, and never will"
>
> Wayne
>
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: First Basic Program
2003-02-25 3:12 First Basic Program Dockeen
2003-02-25 23:02 ` Samuel T. Santos
@ 2003-03-04 6:21 ` LLeweLLyn Reese
1 sibling, 0 replies; 17+ messages in thread
From: LLeweLLyn Reese @ 2003-03-04 6:21 UTC (permalink / raw)
To: Dockeen; +Cc: gcc-help
"Dockeen" <dockeen@mchsi.com> writes:
> Actually I have seen a number of folks argue with
> great vitriol that void main() is *really* the right
> way, usually based on history
Based on a history that ignores the fact that C originated in unix, an
OS which expects every program to have an int return value ?
> and that "life is
> different than standards"
In real life, there is a long list of compilers which have never
accepted 'void main'. One of those compilers is gcc, the topic of
this list.
> or the ever favorite,
> "programming to standards is industrial and I don't
> teach that in my classroom, and never will"
And programming to a tradition that originated at an industry giant,
isn't industrial? (again, people at Microsoft started 'void main'
before there was a C standard.)
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: First basic program
2003-02-25 2:27 ` LLeweLLyn Reese
@ 2003-02-25 2:37 ` Samuel T. Santos
0 siblings, 0 replies; 17+ messages in thread
From: Samuel T. Santos @ 2003-02-25 2:37 UTC (permalink / raw)
To: LLeweLLyn Reese; +Cc: GCC-Help, bjensen
hehehhe
yes
'void main(void)'
but we use Turbo C++ 1.01
very very old...
I mean in Visual C++ it use the standard what is define main with int
return.
Em Seg, 2003-02-24 às 23:23, LLeweLLyn Reese escreveu:
> "Samuel T. Santos" <soujavatambem@uol.com.br> writes:
>
> > ah...
> >
> > Well... in Visual C++ the standard is int I think...
> >
> > but its I learn in the college...
>
> Your college teaches 'void main()' ?
>
> *shiver*
>
>
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: First basic program
2003-02-25 0:36 ` Samuel T. Santos
@ 2003-02-25 2:27 ` LLeweLLyn Reese
2003-02-25 2:37 ` Samuel T. Santos
0 siblings, 1 reply; 17+ messages in thread
From: LLeweLLyn Reese @ 2003-02-25 2:27 UTC (permalink / raw)
To: Samuel T. Santos; +Cc: GCC-Help, bjensen
"Samuel T. Santos" <soujavatambem@uol.com.br> writes:
> ah...
>
> Well... in Visual C++ the standard is int I think...
>
> but its I learn in the college...
Your college teaches 'void main()' ?
*shiver*
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: First Basic Program
2003-02-25 0:49 Dockeen
@ 2003-02-25 1:04 ` Samuel T. Santos
0 siblings, 0 replies; 17+ messages in thread
From: Samuel T. Santos @ 2003-02-25 1:04 UTC (permalink / raw)
To: GCC-Help
hmmm...
i got it.
thanks!
Sams
-> heheheh I know... it save me many times, but to reduce time... I ask,
and to confort too, but I will search!... :)
Em Seg, 2003-02-24 às 21:49, Dockeen escreveu:
> "where I found the ISO C++ Standard and ISO C Standard?"
>
> You can google for the draft standard. The real standard
> costs money.
>
> By the way, you do understand that the quote I gave you is
> from the originator of the C++ language.
>
> Wayne
>
> p.s. Google is our friend, many of the questions you are
> asking can be found there....
>
> www.google.com
>
> through google I found:
>
> http://www.csci.csusb.edu/dick/c++std/
>
>
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: First Basic Program
@ 2003-02-25 0:49 Dockeen
2003-02-25 1:04 ` Samuel T. Santos
0 siblings, 1 reply; 17+ messages in thread
From: Dockeen @ 2003-02-25 0:49 UTC (permalink / raw)
To: gcc-help
"where I found the ISO C++ Standard and ISO C Standard?"
You can google for the draft standard. The real standard
costs money.
By the way, you do understand that the quote I gave you is
from the originator of the C++ language.
Wayne
p.s. Google is our friend, many of the questions you are
asking can be found there....
www.google.com
through google I found:
http://www.csci.csusb.edu/dick/c++std/
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: First Basic Program
2003-02-24 23:57 Dockeen
@ 2003-02-25 0:46 ` Samuel T. Santos
0 siblings, 0 replies; 17+ messages in thread
From: Samuel T. Santos @ 2003-02-25 0:46 UTC (permalink / raw)
To: GCC-Help
Thanks
its very useful!
Sams
Em Seg, 2003-02-24 às 20:57, Dockeen escreveu:
> Google is our friend! I just went to google, searched on gcc simple
> compile example and I found this:
>
> http://galton.uchicago.edu/~gosset/Compdocs/gcc.html
>
> Wayne
>
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: First basic program
2003-02-24 4:31 Dockeen
@ 2003-02-25 0:40 ` Samuel T. Santos
0 siblings, 0 replies; 17+ messages in thread
From: Samuel T. Santos @ 2003-02-25 0:40 UTC (permalink / raw)
To: GCC-Help
Its interesting...
Its eliminate any doubt. :)
for curiosity... where I found the ISO C++ Standard and ISO C Standard?
thanks for the link!
Em Seg, 2003-02-24 às 01:31, Dockeen escreveu:
> Here is a quote from a page from Bjarne that might
> be of some interest on the main returning an int front...
>
>
> "Can I write "void main()"?
> The definition
> void main() { /* ... */ }
>
> is not and never has been C++, nor has it even been C. See the
> ISO C++ standard 3.6.1[2] or the ISO C standard 5.1.2.2.1.
> A conforming implementation accepts
> int main() { /* ... */ }
>
> and
> int main(int argc, char* argv[]) { /* ... */ }
>
> A conforming implementation may provide more versions of main(),
> but they must all have return type int. The int returned by main()
> is a way for a program to return a value to "the system" that
> invokes it. On systems that doesn't provide such a facility the
> return value is ignored, but that doesn't make "void main()"
> legal C++ or legal C. Even if your compiler accepts "void main()"
> avoid it, or risk being considered ignorant by C and C++ programmers.
>
> The quote comes from here:
>
> http://www.research.att.com/~bs/bs_faq2.html#void-main
>
> Wayne
>
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: First basic program
2003-02-24 20:59 ` LLeweLLyn Reese
@ 2003-02-25 0:36 ` Samuel T. Santos
2003-02-25 2:27 ` LLeweLLyn Reese
0 siblings, 1 reply; 17+ messages in thread
From: Samuel T. Santos @ 2003-02-25 0:36 UTC (permalink / raw)
To: GCC-Help; +Cc: bjensen
ah...
Well... in Visual C++ the standard is int I think...
but its I learn in the college...
Em Seg, 2003-02-24 às 17:56, LLeweLLyn Reese escreveu:
> bjorn rohde jensen <bjensen@fastmail.fm> writes:
>
> > Hi there,
> >
> > Opinions differ,
>
> The opinions of the C (89,95,99) and C++ standards have always been
> the same: main must return int.
>
> 'void main()' first came out of Microsoft before the first C standard
> was finalized in 1988. Why it continues to come out of Microsoft
> is beyond me; perhaps their coding standards are still in the
> 80s. :-)
>
> > but it has always been my understanding
> > that main should be declared as returning int:) gcc seems
> > to think so too.
>
> Correct.
>
> [Other correcct stuff about a.out snipped.]
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: First Basic Program
@ 2003-02-24 23:57 Dockeen
2003-02-25 0:46 ` Samuel T. Santos
0 siblings, 1 reply; 17+ messages in thread
From: Dockeen @ 2003-02-24 23:57 UTC (permalink / raw)
To: gcc-help
Google is our friend! I just went to google, searched on gcc simple
compile example and I found this:
http://galton.uchicago.edu/~gosset/Compdocs/gcc.html
Wayne
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: First basic program
2003-02-23 20:57 ` bjorn rohde jensen
2003-02-24 2:36 ` Samuel T. Santos
@ 2003-02-24 20:59 ` LLeweLLyn Reese
2003-02-25 0:36 ` Samuel T. Santos
1 sibling, 1 reply; 17+ messages in thread
From: LLeweLLyn Reese @ 2003-02-24 20:59 UTC (permalink / raw)
To: bjensen; +Cc: Samuel T. Santos, GCC-Help
bjorn rohde jensen <bjensen@fastmail.fm> writes:
> Hi there,
>
> Opinions differ,
The opinions of the C (89,95,99) and C++ standards have always been
the same: main must return int.
'void main()' first came out of Microsoft before the first C standard
was finalized in 1988. Why it continues to come out of Microsoft
is beyond me; perhaps their coding standards are still in the
80s. :-)
> but it has always been my understanding
> that main should be declared as returning int:) gcc seems
> to think so too.
Correct.
[Other correcct stuff about a.out snipped.]
^ permalink raw reply [flat|nested] 17+ messages in thread
* First basic program
@ 2003-02-24 11:05 Samuel T. Santos
2003-02-23 18:58 ` Samuel T. Santos
0 siblings, 1 reply; 17+ messages in thread
From: Samuel T. Santos @ 2003-02-24 11:05 UTC (permalink / raw)
To: GCC-Help
Hello guys!
I run my first program using GCC for Linux! the basic but not boring
Hello World! hehehe
I create a file with VI editor and I wrote the code
and to compile I use "gcc HelloWorld.c"
to messages was show:
HelloWorld.c: In function `main':
HelloWorld.c:4: warning: return type of `main' is not `int
and the Gcc compiler create a file call "a.out*"
My doubts are:
First: to declare the main function I must use the type "int"?
Second: Why GCC create a file call "a.out*"? Why the file call
"HelloWorld*"? How I do that? Its don't generate some intermediate file?
Third: What the common options I use to compile a program?
Fourth: Where I look to see all functions available by GCC?
I use Mandrake 9.0
my code was that:
#include <stdio.h>
void main(void)
{
printf("\t\t\t Helllllooo LINUX World!!\n");
}
til next! :)
Sams
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: First basic program
@ 2003-02-24 4:31 Dockeen
2003-02-25 0:40 ` Samuel T. Santos
0 siblings, 1 reply; 17+ messages in thread
From: Dockeen @ 2003-02-24 4:31 UTC (permalink / raw)
To: gcc-help
Here is a quote from a page from Bjarne that might
be of some interest on the main returning an int front...
"Can I write "void main()"?
The definition
void main() { /* ... */ }
is not and never has been C++, nor has it even been C. See the
ISO C++ standard 3.6.1[2] or the ISO C standard 5.1.2.2.1.
A conforming implementation accepts
int main() { /* ... */ }
and
int main(int argc, char* argv[]) { /* ... */ }
A conforming implementation may provide more versions of main(),
but they must all have return type int. The int returned by main()
is a way for a program to return a value to "the system" that
invokes it. On systems that doesn't provide such a facility the
return value is ignored, but that doesn't make "void main()"
legal C++ or legal C. Even if your compiler accepts "void main()"
avoid it, or risk being considered ignorant by C and C++ programmers.
The quote comes from here:
http://www.research.att.com/~bs/bs_faq2.html#void-main
Wayne
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: First basic program
2003-02-23 20:57 ` bjorn rohde jensen
@ 2003-02-24 2:36 ` Samuel T. Santos
2003-02-24 20:59 ` LLeweLLyn Reese
1 sibling, 0 replies; 17+ messages in thread
From: Samuel T. Santos @ 2003-02-24 2:36 UTC (permalink / raw)
To: GCC-Help
then its a padronization of GCC to declare return type of main a int
I will read them!
thanks!
til more
Em Dom, 2003-02-23 às 17:56, bjorn rohde jensen escreveu:
> Hi there,
>
> Opinions differ, but it has always been my understanding
> that main should be declared as returning int:) gcc seems
> to think so too.
> The reason, you get a file by the name "a.out", is simply,
> that you have not told gcc to call it anything, so it uses
> the traditional default. You should be aware, that creating
> an executable conceptually involves 2 steps; the generation
> of a number of object files from their source .c files, and
> secondly the linking of the object files with various libraries
> to form the executable. In your case, gcc does both.
> Some commonly used options to gcc are; -ansi -pedantic -Wall
> -O3, -c and -o. The first 3 are to get gcc to check/warn about
> a lot of possible mistakes, which might technically be legal,
> but unlikely to be the intention and to reject programs using
> platform specific extensions for better portability. The others
> and plenty more, you can read all about in the nice man pages
> for gcc:)
>
> Yours sincerely,
>
> Bjorn
>
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: First basic program
2003-02-23 18:58 ` Samuel T. Santos
@ 2003-02-23 20:57 ` bjorn rohde jensen
2003-02-24 2:36 ` Samuel T. Santos
2003-02-24 20:59 ` LLeweLLyn Reese
0 siblings, 2 replies; 17+ messages in thread
From: bjorn rohde jensen @ 2003-02-23 20:57 UTC (permalink / raw)
To: Samuel T. Santos; +Cc: GCC-Help
Hi there,
Opinions differ, but it has always been my understanding
that main should be declared as returning int:) gcc seems
to think so too.
The reason, you get a file by the name "a.out", is simply,
that you have not told gcc to call it anything, so it uses
the traditional default. You should be aware, that creating
an executable conceptually involves 2 steps; the generation
of a number of object files from their source .c files, and
secondly the linking of the object files with various libraries
to form the executable. In your case, gcc does both.
Some commonly used options to gcc are; -ansi -pedantic -Wall
-O3, -c and -o. The first 3 are to get gcc to check/warn about
a lot of possible mistakes, which might technically be legal,
but unlikely to be the intention and to reject programs using
platform specific extensions for better portability. The others
and plenty more, you can read all about in the nice man pages
for gcc:)
Yours sincerely,
Bjorn
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: First basic program
2003-02-24 11:05 First basic program Samuel T. Santos
@ 2003-02-23 18:58 ` Samuel T. Santos
2003-02-23 20:57 ` bjorn rohde jensen
0 siblings, 1 reply; 17+ messages in thread
From: Samuel T. Santos @ 2003-02-23 18:58 UTC (permalink / raw)
To: GCC-Help
Hello guys!
I run my first program using GCC for Linux! the basic but not boring
Hello World! hehehe
I create a file with VI editor and I wrote the code
and to compile I use "gcc HelloWorld.c"
to messages was show:
HelloWorld.c: In function `main':
HelloWorld.c:4: warning: return type of `main' is not `int
and the Gcc compiler create a file call "a.out*"
My doubts are:
First: to declare the main function I must use the type "int"?
Second: Why GCC create a file call "a.out*"? Why the file call
"HelloWorld*"? How I do that? Its don't generate some intermediate file?
Third: What the common options I use to compile a program?
Fourth(and more important): Where I look to see all functions available
by GCC?
I use Mandrake 9.0
my code was that:
#include <stdio.h>
void main(void)
{
printf("\t\t\t Helllllooo LINUX World!!\n");
}
til next! :)
Sams
^ permalink raw reply [flat|nested] 17+ messages in thread
end of thread, other threads:[~2003-03-04 6:21 UTC | newest]
Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-02-25 3:12 First Basic Program Dockeen
2003-02-25 23:02 ` Samuel T. Santos
2003-03-04 6:21 ` LLeweLLyn Reese
-- strict thread matches above, loose matches on Subject: below --
2003-02-25 0:49 Dockeen
2003-02-25 1:04 ` Samuel T. Santos
2003-02-24 23:57 Dockeen
2003-02-25 0:46 ` Samuel T. Santos
2003-02-24 11:05 First basic program Samuel T. Santos
2003-02-23 18:58 ` Samuel T. Santos
2003-02-23 20:57 ` bjorn rohde jensen
2003-02-24 2:36 ` Samuel T. Santos
2003-02-24 20:59 ` LLeweLLyn Reese
2003-02-25 0:36 ` Samuel T. Santos
2003-02-25 2:27 ` LLeweLLyn Reese
2003-02-25 2:37 ` Samuel T. Santos
2003-02-24 4:31 Dockeen
2003-02-25 0:40 ` Samuel T. Santos
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).