• 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: Mysterious warning [SOLVED]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Mysterious warning [SOLVED]


  • Subject: Re: Mysterious warning [SOLVED]
  • From: Graham Cox <email@hidden>
  • Date: Wed, 12 Nov 2008 22:30:54 +1100


On 12 Nov 2008, at 10:20 pm, Graham Cox wrote:

I just added some fairly old C++ lex/bison code to my app, code that has been in use for a long time elsewhere and works fine. My app is compiling with much stricter warnings than many of my other projects though, and this line is throwing a warning:


lvalp->val = strtod( --wptr, &wptr );

"warning: operation on 'wptr' may be undefined"

wptr is declared:

	static   char*	wptr = NULL;

Can anyone shed any light on what's wrong here? Hopefully the above is enough to go on.


Never mind, I found the answer on a comp.lang.c archive.

Seems that the order of argument evaluation can't be relied upon, so using the same argument twice in the function call strtod may or may not invoke the preincrement when it should. Moving the preincrement outside the function call fixes the issue.

--Graham


_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Mysterious warning [SOLVED]
      • From: Uli Kusterer <email@hidden>
    • Re: Mysterious warning [SOLVED]
      • From: "Michael Ash" <email@hidden>
References: 
 >Mysterious warning (From: Graham Cox <email@hidden>)

  • Prev by Date: Mysterious warning
  • Next by Date: NSImage in NSAttributedString
  • Previous by thread: Mysterious warning
  • Next by thread: Re: Mysterious warning [SOLVED]
  • Index(es):
    • Date
    • Thread