LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-11-2013, 01:52 PM   #1
saopedrodaserra
Member
 
Registered: Sep 2010
Location: rio de janeiro
Distribution: slackware
Posts: 39

Rep: Reputation: 0
Question c++ 11


Hi!

this code:

int main( void )
{
}

compiles with gcc 4.8.2 on slackware 14.1 without option or -Wall option. No warnings.
???????????
thanks
 
Old 11-11-2013, 03:10 PM   #2
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,912

Rep: Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513
So what is the question?

There are no syntax erros, so there should be no errors.

What results is an empty main function.
 
Old 11-11-2013, 11:13 PM   #3
saopedrodaserra
Member
 
Registered: Sep 2010
Location: rio de janeiro
Distribution: slackware
Posts: 39

Original Poster
Rep: Reputation: 0
the function main "int main()" returns an integer, it cant compile and execute. see other compilers. it is a bug or c++ 11?
 
Old 11-12-2013, 06:33 AM   #4
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,912

Rep: Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513
Depends entirely on the compiler. It isn't a defined error, and at most generates a warning (function returns no value).

And being the main function, a return value isn't required. declaring it "void main(void)" gets the same result...
 
  


Reply

Tags
main



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 Off
HTML code is Off



LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:43 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration