>>>> "Andy" == Andy Piper
<andy(a)xemacs.org> writes:
> * glyphs-x.h (IMAGE_INSTANCE_X_WIDGET_ID): undo C++ changes,
they
> should no longer be needed.
Andy, in plain C the result of a cast is never an lvalue. It's a gcc
extension. Compilation fails with plain old ordinary ANSI C
compilers.
I will undo this part of the patch, because it breaks actual observed
C compiler failure. Again, I'm not suggesting this is the best
solution, but it allows compilation for now.
Index: src/glyphs-x.h
===================================================================
RCS file: /usr/CVSroot/XEmacs/xemacs/src/glyphs-x.h,v
retrieving revision 1.4.2.8
diff -u -r1.4.2.8 glyphs-x.h
--- src/glyphs-x.h 2000/02/13 00:26:22 1.4.2.8
+++ src/glyphs-x.h 2000/02/13 20:18:32
@@ -137,9 +137,9 @@
#define XIMAGE_INSTANCE_X_CLIPWINDOW(i) \
IMAGE_INSTANCE_X_CLIPWINDOW (XIMAGE_INSTANCE (i))
#define IMAGE_INSTANCE_X_SUBWINDOW_ID(i) \
- (* (Window *) & IMAGE_INSTANCE_SUBWINDOW_ID (i))
+ ((Window)IMAGE_INSTANCE_SUBWINDOW_ID (i))
#define IMAGE_INSTANCE_X_WIDGET_ID(i) \
- ( * (Widget *) & IMAGE_INSTANCE_SUBWINDOW_ID (i))
+ ((Widget)IMAGE_INSTANCE_SUBWINDOW_ID (i))
#endif /* HAVE_X_WINDOWS */
#endif /* INCLUDED_glyphs_x_h_ */
From the gcc manual under C Extensions: Generalized Lvalues:
A cast is a valid lvalue if its operand is an lvalue. A simple
assignment whose left-hand side is a cast works by converting the
right-hand side first to the specified type, then to the type of the
inner left-hand side expression. After this is stored, the value is
converted back to the specified type to become the value of the
assignment. Thus, if `a' has type `char *', the following two
expressions are equivalent:
(int)a = 5
(int)(a = (char *)(int)5)
An assignment-with-arithmetic operation such as `+=' applied to a
cast performs the arithmetic using the type resulting from the cast,
and then continues as in the previous case. Therefore, these two
expressions are equivalent:
(int)a += 5
(int)(a = (char *)(int) ((int)a + 5))
You cannot take the address of an lvalue cast, because the use of its
address would not work out coherently. Suppose that `&(int)f' were
permitted, where `f' has type `float'. Then the following statement
would try to store an integer bit-pattern where a floating point number
belongs:
*&(int)f = 1;
This is quite different from what `(int)f = 1' would do--that would
convert 1 to floating point and store it. Rather than cause this
inconsistency, we think it is better to prohibit use of `&' on a cast.
If you really do want an `int *' pointer with the address of `f',
you can simply write `(int *)&f'.