delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/07/09/04:02:52

From: Erik Max Francis <max AT alcyone DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Why won't it change?!?
Date: Sun, 06 Jul 1997 21:44:30 -0700
Organization: Alcyone Systems
Lines: 29
Message-ID: <33C0742E.459A8C69@alcyone.com>
References: <5pnu89$6tr$1 AT missing DOT link DOT ca> <L9iRLHABa4vzEwPQ AT talula DOT demon DOT co DOT uk>
NNTP-Posting-Host: newton.alcyone.com
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Shawn Hargreaves wrote:

> James Edwin Cooper writes:
> >main()
> 
> Pedantic point: that should be 'int main()', and you should put a
> 'return 0;' at the end of the program...

Let's not be so pedantic that we miss the fact that an unspecified return
type defaults to int (this is ANSI), even though it's considered bad style
(where this is not the appropriate place to nitpick about that, because it
varies from person to person).  The only thing he was missing was a return
statement returning a value at the end of the function.

> You probably got a couple of warnings while compiling that, though? If
> not you should put -Wall on your gcc command line, so it will warn you
> about calls to unprototyped functions. You should include stdio.h and
> conio.h to get rid of those warnings, after which you'll get an error
> for the incorrect call to getche().

getche is in conio.h, not stdio.h.  It is in fact non-ANSI.

-- 
       Erik Max Francis, &tSftDotIotE / email / max AT alcyone DOT com
                     Alcyone Systems /   web / http://www.alcyone.com/max/
San Jose, California, United States /  icbm / 37 20 07 N  121 53 38 W
                                   \
           "All the gods are dead / except the god of war."
                                 / Eldridge Cleaver

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019