Help

x0705 wcs at ho95e.UUCP
Tue Aug 27 01:47:33 AEST 1985


> >  When ever I attempt to compile the Fahrenheit-Celsius table program (on pg
> >  8 of _The C Programming Language_) I
> >  get this error:
> > 	"temp.c", line 8: warning: old-fashioned initialization: use =
> > 
> > The line of code is:
> > 	        lower = 0;  /* lower limit of temperature */
> > 
> >  Could someone tell me what I'm doing wrong?
> 
> No, because you didn't supply enough information.
> The program in the book is okay, so the error must be
> in your code.  Check the line or two above where the
> compiler detects the problem.  Especially check for
> extra/missing { } /* */ ;

The error message you got is normally caused by using constructs that resemble
some of the "old-fashioned" language constructs.  For example:
	foo=-40;
used to mean foo -= 40, instead of foo = (-40).  Several generations of
compilers since then have code to reject "old-fashioned" constructs, even
though they're otherwise perfectly legal.

I this case, I'd check to make sure "lower" has been declared, as a scalar
(int or double?), and that you don't have any more variable declarations after
it.  (Since you can't mix decl.'s and executables, the compiler  may be trying
to get out of a bad situation, and guessing wrong about the error.  Also, as
Doug suggests, watch for extra/missing delimiters.
-- 
## Bill Stewart, AT&T Bell Labs, Holmdel NJ 1-201-949-0705 ihnp4!ho95c!wcs



More information about the Comp.lang.c mailing list