• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
gcc4 and casting lvalues
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

gcc4 and casting lvalues


  • Subject: gcc4 and casting lvalues
  • From: Sam Vaughan <email@hidden>
  • Date: Fri, 14 Jan 2005 11:53:26 +1100

It appears that gcc 4 has an issue with casting lvalues:

    % cat > test.c
    #include <stdio.h>

    int main()
    {
        void* vp = 0;

    #ifdef A
        (long*)vp += 1;
    #endif

    #ifdef B
        vp = (long*)vp + 1;
    #endif

        printf("vp: %p\n", vp);

        return 0;
    }
    % gcc-4.0 -DA test.c && ./a.out
    test.c: In function 'main':
    test.c:8: error: invalid lvalue in assignment
    % gcc-4.0 -DB test.c && ./a.out
    vp: 0x4
    % gcc-3.3 -DA test.c && ./a.out
    vp: 0x4
    % gcc-3.3 -DB test.c && ./a.out
    vp: 0x4

Is this expected behaviour?  I might have a lot of code to change...

Sam

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: gcc4 and casting lvalues
      • From: Andrew Pinski <email@hidden>
  • Prev by Date: Building Apple's gcc-1495 on linux x86 for cross-compiling
  • Next by Date: Re: gcc4 and casting lvalues
  • Previous by thread: Building Apple's gcc-1495 on linux x86 for cross-compiling
  • Next by thread: Re: gcc4 and casting lvalues
  • Index(es):
    • Date
    • Thread