Problem using VAX C

H.Bernau ber at astbe.UUCP
Sat Aug 19 01:11:05 AEST 1989


We are having a problem using VAX C.

Chapter 5.5.3 (Equality Operators) of the manual (Guide to VAX C, V2.3) says
that "you can compare a pointer or adress with an integer...".

K&R allows this too.

But the problem appears, when you have an array of integers and you want to
compare one element with an integer. If you forget to specify the index
a UNIX C compiler normally gives a warning message (I'm very happy about that
fact :-) ). The VAC C compiler neither gives a warning nor an error :-(

For example, the folling piece of code will compile without any errors/warnings
using VAX-C (vcc under ULTRIX or cc under VMS):

    main() {

	short j;
	short a[10];

	if( a == j) {
	    ;
	 }
    }


Does anyone knows how to detect these sort of things?

Please mail me, I'll post a summarize to the net.

Thanks
-------------------------------------------------------------------------------
|   Rolf Bernau               |
|   GEI Software Technik mbH  |  Berlin:             astbe!ber
|   Hohenzollerndamm 150      |  USA:                ...!pyramid!tub!astbe!ber
|   1000 Berlin 33            |
|   West-Germany              |
-------------------------------------------------------------------------------



More information about the Comp.lang.c mailing list