• 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: C question for you old guys ;-)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: C question for you old guys ;-)


  • Subject: Re: C question for you old guys ;-)
  • From: Martin Häcker <email@hidden>
  • Date: Mon, 23 Jun 2003 00:24:47 +0200

Hi there,

to get back on topic of programming, could anybody of you tell me why this bit of code produces two different results?


freeSpacePointer adress = 0x00040000; // Really a ((unsigned char *) 0x00040000)
long tryToGet = 1024; // 0x400

// return freeSpacePointer + tryToGet; /* Doesn't work... Why? */
// returns 0x42000
// versus

return (freeSpacePointer)((long)adress + tryToGet);
// returns 0x40400 -- what I wanted to get

I didn't find this by my first attempts of unit-testing, so I'd like to understand it. :) Any advice?

Thanks,
Martin
--
dont.wanna.tell
[ot]coder - hehe
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: C question for you old guys ;-)
      • From: Pete Yandell <email@hidden>
    • C pointer manipulation (was Re: C question for you old guys ;-))
      • From: "Alastair J.Houghton" <email@hidden>
    • Re: C question for you old guys ;-)
      • From: Mark Heath <email@hidden>
References: 
 >Re: C question for you old guys ;-) (From: Jeff Harrell <email@hidden>)

  • Prev by Date: Re: Use libcddb in my Cocoa App
  • Next by Date: Re: Use libcddb in my Cocoa App
  • Previous by thread: Re: C question for you old guys ;-)
  • Next by thread: Re: C question for you old guys ;-)
  • Index(es):
    • Date
    • Thread