operands of : have incompatible types error 
Author Message
 operands of : have incompatible types error


I tried posting this yesterday from GNU Emacs but it didn't appear so
apologies to all if this is a repeat.

I'm trying to compile the make from the Berkeley second network
distribution which I got from ftp.uu.net and am receiving the
following error message repeated many times whilst compiling var.c:

"var.c", line 442: operands of : have incompatible types

This contains the line:

        Buf_AddByte(v->val, (Byte)' ');

Buf_AddByte is a macro which expands to:

--- begin fragment ---
/* Buf_AddByte adds a single byte to a buffer. */
#define Buf_AddByte(bp, byte) \
        (--(bp)->left <= 0 ? Buf_OvAddByte(bp, byte) : \
                (void) (*(bp)->inPtr++ = (byte), *(bp)->inPtr = 0))

void    Buf_OvAddByte();                /* adds a byte when buffer overflows */
--- end fragment ---

I've tried moving the declaration of Buf_OvAddByte before the #define
as well as casting Buf_OvAddByte to void to no avail.

I'm compiling this on a Sparcstation running SunOS 4.1 using the
standard compiler.

If anyone has any ideas, I'd greatly appreciate it.

Brendan B. Boerner              Phone: 512/346-8380

Sat, 15 Oct 1994 23:55:34 GMT  
 operands of : have incompatible types error

(Brendan B. Boerner) notes that he gets the following complaint:

>"var.c", line 442: operands of : have incompatible types

from code of the form:

        extern void f();

        boolean_expr ? f() : (void)expr

>I'm compiling this on a Sparcstation running SunOS 4.1 using the
>standard compiler.

Get your money back on the compiler. :-)  It is broken.  The code is
valid.  The SunOS PCC-based C compiler simply gets (void) casts and
expression-tree types wrong in some cases, including this one.  This
is far from the only bug in the standard SunOS compiler---for instance,
it also accepts

        void f() { int i; (float)i = 1.2; }

Although some people believe this `ought' to be legal, it is not.
(Note that many versions of GCC have an extension that makes this legal,
but give it a completely different meaning than the SunOS compiler.
GCC sets i to 1; SunOS PCC sets i to 1067030938.  Use `gcc -ansi
-pedantic' to confirm that neither is right.)
In-Real-Life: Chris Torek, Lawrence Berkeley Lab CSE/EE (+1 510 486 5427)

Sun, 16 Oct 1994 16:10:17 GMT  
 [ 2 post ] 

 Relevant Pages 

1. operands of : have incompatible types error message

2. error [130] incompatible operands when using constants

3. incompatible operands

4. Inline C Operand Type Error

5. error - incompatible types in assignment ?

6. incompatible pointer type

7. Incompatible function pointer types.

8. newbie: incompatible types in assignment

9. assignment from incompatible pointer type

10. Incompatible types in assignment

11. const/incompatible pointer type grief

12. Incompatible pointer type question


Powered by phpBB® Forum Software