AT&T C compilers
Farrell Woods
ftw at masscomp.UUCP
Sun Mar 5 04:13:39 AEST 1989
In article <1187 at wpi.wpi.edu> lfoard at wpi.wpi.edu (Lawrence C Foard) writes:
>Yes it does [barf]. The c compiler that came with the system VS Gnu-c
[example deleted]
>Maybe WPI is just brain damaged :) but so far every UNIX system I have seen
>here has this problem, so far every PC C compiler has not. Atleast UNIX could
>have implemented the ANSI Prototypes and gotten rid of this bug. This summer I
>had to write a program that converted ANSI style C to old fashioned C so it
>could be run on an HP workstation, the time saved by using ANSI prototypes was
>worth the effort. Actually it doesn't matter if 'A' is a char or integer it
>will get casted into whatever is needed any ways.
Two things:
First, your script points out that whatever Unix compiler you're using
supports the old-fashioned =op, and that gcc does not. Note that since
the operators and operands are jammed together (i.e., no whitespace),
the compiler has no clue that perhaps you really meant "p = -1;". The
tokenizer grabbed the longest token first (in your case, it grabbed
"=-" as a single token. At least you got a warning, but the behavior
is not incorrect, since it is not pANS compliant.
Second, prototypes have nothing to do with this, nor do they have anything
to do with assignments of character constants (which we all know now
ints ;-) ) to chars. This is just a narrowing assignment.
--
Farrell T. Woods Voice: (508) 392-2471
Concurrent Computer Corporation Domain: ftw at masscomp.com
1 Technology Way uucp: {backbones}!masscomp!ftw
Westford, MA 01886 OS/2: Half an operating system
More information about the Comp.lang.c
mailing list