Re: Why is this not a modifiable lvalue.

Discussion in 'C Programming' started by Micah Cowan, Jun 28, 2003.

  1. Micah Cowan

    Micah Cowan Guest

    "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
    Micah Cowan, Jun 28, 2003
    #1
    1. Advertising

  2. Micah Cowan

    CBFalconer Guest

    Micah Cowan wrote:
    >

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


    I have recently taken to adding -wwrite-strings.

    --
    Chuck F () ()
    Available for consulting/temporary embedded and systems.
    <http://cbfalconer.home.att.net> USE worldnet address!
    CBFalconer, Jun 28, 2003
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Simon Biber

    Re: Why is this not a modifiable lvalue.

    Simon Biber, Jun 27, 2003, in forum: C Programming
    Replies:
    0
    Views:
    2,342
    Simon Biber
    Jun 27, 2003
  2. Dan Pop

    Re: Why is this not a modifiable lvalue.

    Dan Pop, Jun 27, 2003, in forum: C Programming
    Replies:
    6
    Views:
    4,886
    Dan Pop
    Jun 30, 2003
  3. Martin Ambuhl

    Re: Why is this not a modifiable lvalue.

    Martin Ambuhl, Jun 27, 2003, in forum: C Programming
    Replies:
    0
    Views:
    693
    Martin Ambuhl
    Jun 27, 2003
  4. Mr. SweatyFinger
    Replies:
    2
    Views:
    1,742
    Smokey Grindel
    Dec 2, 2006
  5. Kavya

    lvalue -modifiable and non-modifiable

    Kavya, Nov 6, 2006, in forum: C Programming
    Replies:
    3
    Views:
    423
    Keith Thompson
    Nov 6, 2006
Loading...

Share This Page