Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!cbatt!ihnp4!qantel!lll-lcc!lll-crg!nike!ucbcad!ucbvax!jade!eris!mwm From: mwm@eris.berkeley.edu (Mike Meyer) Newsgroups: net.micro.amiga Subject: Re: Vt100 v2.1 warnings Message-ID: <1344@jade.BERKELEY.EDU> Date: Fri, 26-Sep-86 20:44:12 EDT Article-I.D.: jade.1344 Posted: Fri Sep 26 20:44:12 1986 Date-Received: Tue, 30-Sep-86 06:34:21 EDT References: <8609261713.AA28743@cory.Berkeley.EDU> Sender: usenet@jade.BERKELEY.EDU Reply-To: mwm@eris.UUCP (Mike Meyer) Organization: Missionaria Phonibalonica Lines: 43 In article <8609261713.AA28743@cory.Berkeley.EDU> dillon@CORY.BERKELEY.EDU (Matt Dillon) writes: >>Phil Hunt writes: >> Line 427 and 490, Warning 85: Function return value mismatch >> any ideas? > > The author did something like: > > ptr = function() > > Where the function returned an integer and not a pointer. It's only >a warning on Lattice becomes integers and pointers are the same size anyway. I'm surprised. Matt's statement of fact are usually correct, but not in this case. He's right so often I double-checked the manual to make sure my memory wasn't wrong. Lo and behold, we find: 85 [...] The expression specifying the value to be returned by a function was not of the same type as the function itself. In other words, the expression on a return statement had the wrong type. The compiler usually casts them to the correct type, if possible (this is correct ANSI/K&R behavior) and issues the warning. However, the most common code that generates this warning looks like: func() { /* Declare function returning int */ ... return ; /* No return value! */ } When it should actually be: void func() { /* No value returned */ ... return ; /* Sure enough, ... */ } This is just a minor problem, and will usually do what you want. Like Matt's example, though, it's a bad habit to get into. On the other hand, if the function really returns something, then this is a bug.