Newsgroups: comp.sys.apple2 Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!floyd From: floyd@itsgw.rpi.edu (Patrick J Wetmore) Subject: Re: Orca/C bug (void functions) Message-ID: Nntp-Posting-Host: jec416.its.rpi.edu Organization: Rensselaer Polytechnic Institute, Troy NY References: <1991Apr6.083344.26760@rbdc> Distribution: usa Date: 8 Apr 91 22:11:03 GMT Lines: 40 In article <1991Apr6.083344.26760@rbdc> barry@rbdc.UUCP (Barry Newberry) writes: >It appears that an old bug (feature?) has been left in Orca/C. Of course, >I never wrote Mike (W.) about it, because I thought someone else would >(my mistake). The compiler won't allow called functions to be type void. >The compiler blames the next line of code for the problem. From what I've >read, ANSI C allows functions to be type void, so I shouldn't have any >trouble with the following program. Changing type void functions to type >int takes care of the problems, but I like to use void for functions >which can't have errors or don't have to return values. > >/****************strange C program**************/ It's ansi prototyping preventing you from making horrible mistakes. insert this line about here: ------ void thing(); ------ That will declare thing to be a function taking unknown parameters and returning void. >void main (void) >{ > thing (); As thing was not declared previously, the compiler assumed it was of type int. >} > >void thing (void) Because thing is being re-declared as void, it will give you a duplicate symbol error. >{ >} pat!