Why this code works on AIX, NeXT, BUT NOT OTHERS (SunOS, Ultrix) ?

Why this code works on AIX, NeXT, BUT NOT OTHERS (SunOS, Ultrix) ?

Post by Rob Qui » Wed, 10 Feb 1993 04:17:10




Quote:>I'm having difficulty understanding why my code wouldn't work
>on (it seems like) anything other than AIX or NeXT.
>extern int in_list (char *, logins *); /* CODE DIES HERE */
>The code always produces a syntax error at the first line
>following the thread typedef. This behaviour has been observed
>with both SunOS (4.1.2 (?)) on IPC, and DYNIX V3.2.0. Doing
>a `lint' on only this code produces many syntax errors. So
>does the standard `cc' compilers.

 SunOS's cc doesn't take ANSI C code. Try gcc instead.

Quote:>Any suggestions ? About five programmers looked at the code
>and shrugged,

 Tell them they are fired.
--
|                                                                   Rob Quinn |


 
 
 

Why this code works on AIX, NeXT, BUT NOT OTHERS (SunOS, Ultrix) ?

Post by Mike O'Conn » Wed, 10 Feb 1993 09:04:52



:I'm having difficulty understanding why my code wouldn't work
:on (it seems like) anything other than AIX or NeXT. Here's the
:fragment it is having difficulty dealing with:

Use an ANSI C compiler like gcc on those SunOS and Ultrix systems and
see how well your code compiles.

:)

--

 Ford Motor Company, OPEO      |  UUCP:      ...!fmsrl7!opeo!mjo
 20000 Rotunda, Bldg. 1-3001   |  Phone:     +1 (313) 248-1260
 Dearborn, MI  48121           |  Fax:       +1 (313) 323-6277

 
 
 

Why this code works on AIX, NeXT, BUT NOT OTHERS (SunOS, Ultrix) ?

Post by Ade Bark » Wed, 10 Feb 1993 13:52:03


THANKS for the many replies. As I just jumped into Unix programming
in recent years, I wasn't aware that most Unix systems default
compilers are not ANSI conforming.

Summary of solutions include installing an ANSI C compiler (either
commercial or GCC) on all the sites, or translating the code to
K&R either manually or by using unprotoize.

Thanks for the reality check,

-Ade Barkah
--

CompuServe: 74160,3404

 
 
 

Why this code works on AIX, NeXT, BUT NOT OTHERS (SunOS, Ultrix) ?

Post by Ade Bark » Wed, 10 Feb 1993 01:17:48


I'm having difficulty understanding why my code wouldn't work
on (it seems like) anything other than AIX or NeXT. Here's the
fragment it is having difficulty dealing with:

(from finder.h)

/*-- finder.h begins here */

#define MAXNAME         20
#define MAXHANDLE       25
#define MAXADDRESS      255
#define FINGER          79
#define BUFLEN          65535
#define PACKET          1024
#define TRUE            1
#define FALSE           0

struct buffer_struct
{
        char name[MAXNAME];
        char handle[MAXHANDLE];
        char address[MAXADDRESS];
        struct buffer_struct *next;
        struct buffer_struct *prev;
        short logged;

Quote:};

typedef struct buffer_struct names;

struct login_struct
{
        char *login;
        struct login_struct *next;

Quote:};

typedef struct login_struct logins;

struct thread_struct
{
        names *pointer;
        struct thread_struct *next;

Quote:};

typedef struct thread_struct thread;

extern int in_list (char *, logins *); /* CODE DIES HERE */
extern thread *group (names *);
extern void process_group (thread *);
extern logins *grep (char *);
extern names *sort_insert (names *, names *);
extern char *finger (char *);

#ifdef NEEDS_STRDUP
char *strdup (char *);
#endif

/*---end of finder.h---*/

The code always produces a syntax error at the first line
following the thread typedef. This behaviour has been observed
with both SunOS (4.1.2 (?)) on IPC, and DYNIX V3.2.0. Doing
a `lint' on only this code produces many syntax errors. So
does the standard `cc' compilers.

SunOS quit compiling with `too many errors.' Trying it with
Dynix and Ultrix gives similar results.

Now, here's the mystery: when I was writing the code, I worked
mainly with AIX 3.2 and the NeXT. The above code (in fact the
whole program) didn't produce _any_ errors (using standard cc.)
Not even a warning.

Any suggestions ? About five programmers looked at the code
and shrugged, it looks fine to us (and to the AIX and NeXT
compilers.) Of course, we could be overworked, and perhaps
our computers have been turned on for too long.

Regards,

-Ade Barkah.
--

CompuServe: 74160,3404