comp.unix.xenix

Tim Kuehn timk at xenitec.on.ca
Sun Nov 26 07:40:09 AEST 1989


In article <69 at van-bc.UUCP> jtc at van-bc.UUCP (J.T. Conklin) writes:
>In article <529 at s5.Morgan.COM> amull at Morgan.COM (Andrew P. Mullhaupt) writes:
>I think that the lack of comprehensive diagnostics is the most serious
>drawback of the present SCO UNIX/XENIX C compilers.
>
>Given the compiler technology availiable today, there is absolutely
>no excuse for poor diagnostics.

Which is probably why Lint(CP) is included in with the development system. 
Although it doesn't display error messages as comperable to the one's you're
looking for (following), the docs state that it "attempts to detect features
of the C program <file> that are likely to be bugs, nonportable, or wasteful. 

>For example, I would expect the following code:
>
>    #include <stdio.h>
>
>    main(argc, argv)
>    {
>	printf("hello, world!\n")
>	printf("%d, %d\n", foo bar);
>    }
>
>
>to produce error messages similar to the following:
>
>    cc1: Warning: foo.c: line 5: Inserting Missing Semicolon
>	    printf("hello, world!\n")
>	 ----------------------------^

How would a compiler know that's supposed to be a semi-colon and not a 
math/string/pointer operator of some kind? 

>    cc1: Error:   foo.c: line 6: Undefined Identifier
>	    printf("%d, %d\n", foo bar);
>	 ----------------------^

Undefined, missing comma, or extra space? 

>    cc1: Warning: foo.c: line 6: Inserting Missing Comma
>	    printf("%d, %d\n", foo bar);
>	 -------------------------^

Missing comma, math/string/pointer operand or other? 

While what you ask for sounds *very* nice (and I'd love to have a C compiler
that'd do diagnostics like that!) it involves a level of intuiting what the 
programmer was trying to do, and I for one would rather the compiler just
tell me "this is what's wrong, and here's what's wrong with it." rather 
than just spitting out an error code I'd have to look up in a ref. manual 
somewhere. To have the compiler modify the code, or how the code behaves, 
particularly in the case of a error (ie unknown) condition is something that
I would *not* want. (How would you know what the compiler's really done with 
your code then?)

(I liked the HP 3000 compilers for that, if the error message wasn't clear 
enough, you could go to the manual, find the error number, and the manual 
would tell you more specifically what the error meant and suggest ways to 
correct the problem.)

+-----------------------------------------------------------------------------+
|Timothy D. Kuehn	       			       timk at xenitec.on.ca     |
|TDK Consulting Services			       !watmath!xenitec!timk  |
|871 Victoria St. North, Suite 217A					      |
|Kitchener, Ontario, Canada N2B 3S4 		       (519)-741-3623 	      |
|DOS/Xenix - SW/HW. uC, uP, DBMS. 		       Quality SW Guaranteed  |
+-----------------------------------------------------------------------------+



More information about the Comp.unix.xenix mailing list