Skip to main content.
home | support | download

Back to List Archive

Re: Fails to compile as ANSI or K&R

From: Kenneth Green <kenneth_green(at)not-real.hp.com>
Date: Wed Oct 07 1998 - 23:09:02 GMT
Mark,

Thanks for the response.

The way I originally discovered that the code is not K&R compliant
was indeed by commenting out the "FUNCTION_PROTOTYPES_INCLUDE_ARGS"
#define.

Some of the code recently added to SWISH-E (perhaps by you ;-)
has ANSI-specific elements and hence will not compile with a true
K&R compiler.

If I get the time I will convert all of the code to pure ANSI,
abandoning any attempt to maintain K&R compatibility since
(a) everyone seems to have access/be using gcc or other ANSI
capable compilers and (b) there are many advantages to the ANSI
standard.

If I am successful in completing this update I will submit it back
to the SWISH-E team at SunSite and they can decide whether they
want to adopt it, or not.

Rgds,
Kenneth

Mark Gaulin wrote:
> 
> Hi Kenneth
> I am on NT (and did the Win32 port of 1.2). I would have loved to
> completely
> convert the code to ANSI but I did not consider that to be a "safe"
> thing
> for me to do... after all, I'm using a MS compiler, and what's good
> for MS
> is (usually) not good for someone else.
> 
> if your compiler does not want to mix ANSI and K&R function
> definitions then you can turn off ANSI declarations by commenting out
> the #define of "FUNCTION_PROTOTYPES_INCLUDE_ARGS" in the
> file config.h.  If you look a little further down in config.h you will
> see the
> definition of the macro _AP() which controls how the function
> prototypes
> are seen by your compiler.  This ought to go a long way toward getting
> it to compile.
> 
> It seems to me that by now all C compilers ought to be ANSI
> compatible.
> Most compilers are forgiving enough to let you mix and match, which is
> pragmatic but sad from the point of view of actually reaping the
> benefits
> of the ANSI standard. A big question when doing the port was "What
> will
> gcc do on other platforms with respect to ANSI function definitions?"
> If there was a consensus that ANSI-style function definitions are ok
> then
> I would replace all of the K&R functions with ANSI ones. (My C++
> background
> makes me hate the K&R style anyway.)
> 
>         Mark


-- 
========================================================================
Kenneth Green                           +61 3 9210 5541 Tel. & Voicemail
R&D Project Manager                     +61 3 9210 5550 FAX
                                        kenneth_green@hp.com
Advanced Networks Division              PO Box 221, Blackburn Vic 3130
Hewlett-Packard Australia Ltd           AUSTRALIA
========================================================================
Received on Wed Oct 7 16:20:02 1998