Xref: utzoo comp.lang.c:20925 comp.os.vms:16898
Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.csd.uwm.edu!cs.utexas.edu!uunet!mcvax!unido!tub!astbe!ber
From: ber@astbe.UUCP (H.Bernau)
Newsgroups: comp.lang.c,comp.os.vms
Subject: Problem using VAX C
Message-ID: <616@astbe.UUCP>
Date: 18 Aug 89 15:11:05 GMT
Reply-To: ber@astbe.UUCP (H.Bernau)
Organization: GEI Software Technik Berlin, Germany
Lines: 39


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              |
-------------------------------------------------------------------------------