"David Crayford" <> writes:
> I ported some code which compiles ok on my PC using GCC but fails using the
> mainframe OS/390
> and z/OS compilers.
>
> static void exchange(void *a, void *b, size_t size) {
>
> <snip>
>
> *(((int *)a)++) = *((int *)b);
>
> produces the following compiler error
>
> Operand must be a modifiable lvalue
>
> The cast should take care of that, shouldn't it?
If you compile using GCC with the -pedantic flag, you'll at least get
the required diagnostic (warning) before GCC continues on to finish
compiling.
To get a (mostlhy) conformant C implementation from GCC, you need to
at least compile with the -ansi and -pedantic flags. Many here would
recommend using:
gcc -O2 -W -Wall -ansi -pedantic
HTH,
Micah
|