Re: BUG LIST WITH FIXES

From: Edward Almasy (almasy@axis.com)
Date: 07/22/95


Ryan writes:
> On Sat, 22 Jul 1995, Jeremy Elson wrote:
> > returning a *pointer* to the structure, which I'm not, then it would need
> > to be declared as static.  But I'm just returning a value.  It's like saying
> > "return 52" or "return x" where x is an integer.  return returns a value,
> > not a reference so static is not necessary here.  Putting it in won't break
> > anything but it doesn't have to be there.
> 
> Even use checkergcc?  It will tell you that this is wrong and trust me, 
> from experience checkergcc is NOT wrong :)

Well, in this case it obviously is.  In ANSI C (with which gcc is
99.9% compliant), functions can returns structures by value, and that
is what is happening at the end of this routine.

Check out K&R 2nd Edition, sections A7.17 and A9.6.  If you don't own
or have access to a copy, then get one.  It's much more authoritative
than "checkergcc". :-)


 \_\_\_     _/ \_\_\_  axis data: specializing in online system setup & design
 \_  \_     _/ \_  \_    Edward Almasy                       almasy@axis.com  
 \_\_\_     _/ \_\_\_    President: Axis Data   Proprietor: NineJackNine BBS
     \_ _/  _/     \_    608-256-5732 (voice)            608-256-5697 (data)
 \_\_\_ _/_/_/ \_\_\_  9jack9: on the bleeding edges of culture and technology



This archive was generated by hypermail 2b30 : 12/07/00 PST