• 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
Re: Why doesn't gcc 4 like this?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Why doesn't gcc 4 like this?


  • Subject: Re: Why doesn't gcc 4 like this?
  • From: Tim Conkling <email@hidden>
  • Date: Sat, 4 Jun 2005 16:55:59 -0400

I guess my question is, why is it not an lvalue? This code produces no such error:

char* srcRowStart;
...
srcRowStart += framePort->getRowBytes();

The only difference is that I'm not casting srcRowStart from a short* to a char*.

Thanks,
Tim

On Jun 4, 2005, at 4:22 PM, Andrew Pinski wrote:


On Jun 4, 2005, at 4:38 PM, Tim Conkling wrote:


For the following bit of code, gcc reports the following warning: "/Users/tconklin/Everything Else/Programming/My Projects/Gnomez/ GnomeSpritez/source/Sprite/MySprite.cpp:298: warning: target of assignment not really an lvalue; this will be a hard error in the future":

short*            srcRowStart;
...
((char*) srcRowStart) += framePort->getRowBytes(); <-- error here

(getRowBytes() returns a UInt32)

What does this warning mean?



"((char*) srcRowStart)" is not a lvalue which means it can be assigned to.
You want to do the following instead:
srcRowStart = (short*)((char*)(srcRowStart) + framePort->getRowBytes ());


which fixes the problem and turns this into valid C instead using a
removed extension from the FSF GCC 4.0.0, Apple added it back to their 4.0
but still questionable at what it should do.


Thanks,
Andrew Pinski



_______________________________________________ Do not post admin requests to the list. They will be ignored. Xcode-users mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Re: Why doesn't gcc 4 like this?
      • From: Andrew Pinski <email@hidden>
References: 
 >Why doesn't gcc 4 like this? (From: Tim Conkling <email@hidden>)
 >Re: Why doesn't gcc 4 like this? (From: Andrew Pinski <email@hidden>)

  • Prev by Date: Re: Why doesn't gcc 4 like this?
  • Next by Date: Re: Why doesn't gcc 4 like this?
  • Previous by thread: Re: Why doesn't gcc 4 like this?
  • Next by thread: Re: Why doesn't gcc 4 like this?
  • Index(es):
    • Date
    • Thread