Skip to main content.
home | support | download

Back to List Archive

Fails to compile as ANSI or K&R

From: Kenneth Green <kenneth_green(at)>
Date: Tue Oct 06 1998 - 23:56:36 GMT

   ** Please reply by direct email to **

I just downloaded the 1.2 release of Swish-E to make the upgrade from
the 1.1 release.

To my dismay I have found that the source code is neither strictly
K&R nore strictly ANSI compatible. Some samples from the code of
the K&R and ANSI violations are given below.

While I understand that gcc has a 'forgiving' (some would say slack;-)
mode, the HP compilers do not, and in require strict adherence to
the standards.

I cannot understand how these basic violations could be present unless
I am the only one in the world not using gcc !

In any case I would be interested in hearing from anyone who has
struck these problems and has a solution, other than editting all
of the violating source code to make it genuinely ANSI compatible.

Sample K&R violations:

 File:    http.c
 Code:    void indexpath(char *url)
 Problem: This is an ANSI "new style" function definition which is
          not parsable by a strict K&R compiler

 File:    index.c
 Code:     .... 10.0f)
 Problem: The 'f' suffix indicating 'float' is an ANSI feature. For
          K&R code you must use a prefix type cast like: "(float)10.0"

Sample ANSI violations:

 File:    check.h, check.c
 Code:    declaration = int isvowel _AP ((char));
          definition  = int isvowel(c)
                            char c; 
 Problem: ANSI requires the declaration and definition styles to
          match. Here we have a 'new style' declaration with an
          'old style' definition.

          One reason this is a problem relates to the type expansion
          and contraction performed by the compiler on the formal

Kenneth Green                           +61 3 9210 5541 Tel. & Voicemail
R&D Project Manager                     +61 3 9210 5550 FAX
Advanced Networks Division              PO Box 221, Blackburn Vic 3130
Hewlett-Packard Australia Ltd           AUSTRALIA
Received on Tue Oct 6 17:07:29 1998