[net.lang.c] Compiler Error Checking and Error Messages - How much is too much?

steiny@scc.UUCP (Don Steiny) (09/14/85)

*** REPLACE THIS LINE WITH YOUR MESSAGE ***
***

	I have seen C compilers that do Pascal-like things and
try to point to the line and position of the error.   My opinion
is that this is inappropriate.  I have not had any trouble 
locating errors from the error message I get from the terse
compilers on version 6 & 7.   I even think that the 4.1 and
4.2 compilers are a bit wordy, but I don't mind too much.

	I used a compiler once that made assignment of pointer
to an int a FATAL ERROR.   Note that on this system both 
pointers and ints were 32 bits.  Since the compiler on the 
system I generally use, a Wollongong V7 port, does not even 
complain about it, it seems to me that making it completely 
illegal might break much exisiting code.  It certainly broke 
some of mine.  It seems like a strange thing to do to me, but
is it a bug or a useful feature?   It would force future
code to be more portable, but it would break some existing
C code.

	I can think of two solutions.   One would be to have
flags for the compiler that allowed compilation of code from
older compilers.   Compilers could also have a verbose or
non-verbose mode.  Another solution would be to have the compiler
do the best job it can compiling the code for the specific
machine it is for and have lint or a lint like tool do all
the portability checking.

	I favor the second solution.   But if flags are added,
I believe that non-verbose mode would be the most useful
default.  I find the verbose messages confusing, all I
need is the line number and I can spot the error right
away.   I think that using separate programs fits 
more in the UNIX philosophy of separate tools that
can be combined by users. 

	I would be interested to know what others think about
it. 
-- 
scc!steiny
Don Steiny @ Don Steiny Software 
109 Torrey Pine Terrace
Santa Cruz, Calif. 95060
(408) 425-0382

mjs@sfmag.UUCP (M.J.Shannon) (09/15/85)

A comment, if I may: Up until now, C has been an evolving language.  With the
upcoming standardization of the language by a recognized body (ANSI), compiler
writers are less free to impose super-strict interpretation of the intent of
the language *unless such is permitted or required by the standard*.  This is
a *good thing*.  It precludes exactly what you're complaining about (except in
the case of a machine which does not yet have a conforming compiler).  I
haven't thought much on what this means to folks writing code to be super
portable (i.e., to both ANSI conforming compilers and to older compilers), but
I believe there's a suitable common subset that is useable for this purpose.

Perhaps discussion of this subset is a good topic for this group?
-- 
	Marty Shannon
UUCP:	ihnp4!attunix!mjs
Phone:	+1 (201) 522 6063
Disclaimer: I speak for no one.

gwyn@brl-tgr.ARPA (Doug Gwyn <gwyn>) (09/16/85)

> 	I used a compiler once that made assignment of pointer
> to an int a FATAL ERROR.   Note that on this system both 
> pointers and ints were 32 bits.

Perhaps it would have let you if you'd used a type cast?
In any case, this is certainly nonportable usage.

ANSI X3J11 (q.v.) attempts to define proper behavior in such cases.