Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums
Old 05-12-2003, 12:27 PM   #1 (permalink)
hazmat
Registered User
 
hazmat's Avatar
 
Join Date: Apr 2003
Location: Baltimore, Md
Posts: 2
hazmat is on a distinguished road
Send a message via AIM to hazmat
grr... stupid linux

So im writing a dumb little program to test some libraries i just wrote. I'm new to writing code under linux but i know you have to return an exit status thingy. All the code i've pretty much ever seen ended with either

return 0;

or

return EXIT_SUCCESS;
which i presume to just be defined as 0.

however, whenever i do any of these, gcc still ALWAYS tells me that "main() must return int." and wont compile. I've tried
just about every variation of return 0; that you can imagine, it just still wont compile!

what the heck am i doing wrong?
thanks!

-jordan
hazmat is offline   Reply With Quote
Old 05-12-2003, 12:36 PM   #2 (permalink)
hazmat
Registered User
 
hazmat's Avatar
 
Join Date: Apr 2003
Location: Baltimore, Md
Posts: 2
hazmat is on a distinguished road
Send a message via AIM to hazmat
oops

ok, so i can anwser my own question.
just becuase i was taught to always make main void, doesnt mean its right.
Stupid comp. sci. teacher.

so, from now on:

int main() {
return 0;
}

yes?

yes.

Thank you.

-Jordan
hazmat is offline   Reply With Quote
Old 05-12-2003, 08:59 PM   #3 (permalink)
alpha
Regular Contributor
 
Join Date: Feb 2003
Posts: 120
alpha is on a distinguished road
Send a message via AIM to alpha
Yes, standard calls for main. main should not return void. although, will work with older compilers, newer compilers will only want int main and will complain about anything else.
alpha is offline   Reply With Quote
Old 05-12-2003, 10:17 PM   #4 (permalink)
DesertWolf
Non-profit Techie
 
DesertWolf's Avatar
 
Join Date: Dec 2002
Location: Mesa AZ
Posts: 76
DesertWolf is on a distinguished road
Send a message via AIM to DesertWolf
C was changed to return an int instead of void when it went ot ANSI C standard.
DesertWolf is offline   Reply With Quote
Old 05-18-2003, 02:52 PM   #5 (permalink)
Antagony
Registered User
 
Antagony's Avatar
 
Join Date: Mar 2003
Posts: 31
Antagony is on a distinguished road
Send a message via ICQ to Antagony
Yeah. The first thing you should know about high school "computer science" is that they teach you everything incorrectly. That seems to the collective of all experiences I've gathered.
Antagony is offline   Reply With Quote
Old 05-18-2003, 06:24 PM   #6 (permalink)
saline
I am red.
 
saline's Avatar
 
Join Date: Feb 2003
Location: Cleveland, OH
Posts: 139
saline is on a distinguished road
well..... true but not entirely

See, I loved high school computer science, all the theory and algorithms they teach (in my experience) were correct and infinitely useful.

HOWEVER

The classes they use to teach vectors and such (apvector, apstack etc..) will completely screw you up later. If you're coming out of AP comp sci and going into college and haven't done coding outside that this transition is (as it was for me) the hardest part of getting into college programming courses.

I spent literally days trying to figure out what the hell a namespace was and why it should be std and then what it actually did.

There were good reasons for why the college board did things this way but that reason is being eliminated because the AP Comp Sci test and therefor the course is being switched over to Java.
__________________
http://home.cwru.edu/~cak19

It's my homepage with odd little bits of javascript.
saline is offline   Reply With Quote
Old 05-18-2003, 08:33 PM   #7 (permalink)
alpha
Regular Contributor
 
Join Date: Feb 2003
Posts: 120
alpha is on a distinguished road
Send a message via AIM to alpha
Re: well..... true but not entirely

Quote:
Originally posted by saline
See, I loved high school computer science, all the theory and algorithms they teach (in my experience) were correct and infinitely useful.

HOWEVER

The classes they use to teach vectors and such (apvector, apstack etc..) will completely screw you up later. If you're coming out of AP comp sci and going into college and haven't done coding outside that this transition is (as it was for me) the hardest part of getting into college programming courses.

I spent literally days trying to figure out what the hell a namespace was and why it should be std and then what it actually did.

There were good reasons for why the college board did things this way but that reason is being eliminated because the AP Comp Sci test and therefor the course is being switched over to Java.
very true. I am glad that I have ventured out of the class and went on web boards. Otherwise, I would be like my other classmates that plan to do CS, CpE, or EE. I'm glad I programmed out of class, because those classes would screw some people over. i.e. your example of namespace std, etc. The ap classes don't have certain fxns that the c++ libraries do. I wrote some code on the side during free time in class, and classmates were asking me what std:: stuff was, or namespace, or why int main(). (My teacher taught void main, she knew it was int main, but she thought it would be easier for people to understand void main; ah whatever, she's still a great programmer, awesome teacher). I wish them the best, but it may take them a while to pick up on college programming classes, if taught in C++.
alpha is offline   Reply With Quote
Old 05-18-2003, 08:34 PM   #8 (permalink)
alpha
Regular Contributor
 
Join Date: Feb 2003
Posts: 120
alpha is on a distinguished road
Send a message via AIM to alpha
Quote:
Originally posted by Antagony
Yeah. The first thing you should know about high school "computer science" is that they teach you everything incorrectly. That seems to the collective of all experiences I've gathered.
The algorithms and such were taught to me well. Only a few things I can complain about, but mostly through the collegeboard code.
alpha is offline   Reply With Quote
Old 05-18-2003, 10:37 PM   #9 (permalink)
DesertWolf
Non-profit Techie
 
DesertWolf's Avatar
 
Join Date: Dec 2002
Location: Mesa AZ
Posts: 76
DesertWolf is on a distinguished road
Send a message via AIM to DesertWolf
If you have a good program logic an design class to set your basics then it doesn't really matter what language or specific Headers or API's you use in school. The art is constantly changing and as a programmer you need to be able to adjust to the current standards. I learned programming in basic on an old IBM back in the late 70's, but I have ben able to apply or adapt the basic programming logic as the languages have changed.
we still have for loops and if- else loops and when- if loops and conditonals, those haven't changed, mainly it is the way we look at the data or the information that we are working with that has changed.
DesertWolf is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

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 On


Similar Threads
Thread Thread Starter Forum Replies Last Post
So Basic, So Stupid. BulletproofPeep Standard C, C++ 2 03-24-2004 06:34 PM
GCC status update sde Code Newbie News 0 01-09-2004 07:45 AM
most stupid question evaaaa!!! toAst Lounge 12 03-08-2003 07:47 PM
Stupid question w00t Linux / BSD / OS X 3 02-18-2003 11:58 PM


All times are GMT -8. The time now is 06:15 AM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0 RC8





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting