Xref: utzoo comp.sys.amiga.programmer:587 comp.std.c:4242 Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!samsung!sdd.hp.com!news.cs.indiana.edu!maytag!csg.uwaterloo.ca!giguere From: giguere@csg.uwaterloo.ca (Eric Giguere) Newsgroups: comp.sys.amiga.programmer,comp.std.c Subject: Re: ANSI prototypes, the right choice... Message-ID: <1991Feb5.155953.26790@maytag.waterloo.edu> Date: 5 Feb 91 15:59:53 GMT Sender: daemon@maytag.waterloo.edu (Admin) Organization: Computer Systems Group, University of Waterloo Lines: 50 In article <7708@sugar.hackercorp.com> peter@sugar.hackercorp.com (Peter da Silva) writes: >For all you Lattice-C programmers, I have a little hint for writing more >portable programs: > > int foo(int a, int b); > >This is *not* compatible with a function declared: > > int foo(a, b) > int a, b; > { > ... > } Strictly speaking, this is not true. What you are describing must be a Lattice-specific warning. Problems WOULD arise if you had the following declarations: int foo( char a, char b ); int foo( a, b ) char a, b; { ... } The prototype won't agree because the "char a, b" in the second declaration will get promoted to "int a, b" using the old-style default promotion rules. (I.e., char & short --> int, float --> double). If you're not going to be using prototypes all the time, then you should make sure that any functions you declare in the new style, such as: int fubar( char a, float b, int c ) { } should actually look like: int fubar( int a, double b, int c ) { } If you take a look at the ANSI standard library you'll see they made all the library functions look like this so that lack of prototypes won't bite you... -- Eric Giguere giguere@csg.UWaterloo.CA Quoth the raven: "Eat my shorts!" --- Poe & Groening