• 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: Is pointer syntax logical?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Is pointer syntax logical?


  • Subject: Re: Is pointer syntax logical?
  • From: Kevin Kuehl <email@hidden>
  • Date: Thu, 26 Jul 2007 15:21:36 -0700 (PDT)

--- Daniel DeCovnick <email@hidden> wrote:

> Having one declare a type, both automatic and
> heap-allocated, and not
> allowing dereferencing of a void *, is as close as C
> comes to strong
> typing. And it does not come any closer:
>
> float f = 5.123;
> float *fp = &f;
> int *ip = (int *)fp;
>
> is perfectly valid code. But you'll find that *ip is
> not 5. Rather,
> it's 1084485534. This may well be machine-dependent.

I fail to understand the point of this example.  No
one who knows C would expect the value "*ip" to be 5.
"ip" points to a memory location containing the
floating point representation of 5.123 and that isn't
00000000 00000000 00000000 00000101.

Kevin Kuehl
email@hidden
_______________________________________________

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: Is pointer syntax logical?
      • From: Daniel DeCovnick <email@hidden>
References: 
 >Re: Is pointer syntax logical? (From: Daniel DeCovnick <email@hidden>)

  • Prev by Date: Re: Is pointer syntax logical?
  • Next by Date: Re: Is pointer syntax logical?
  • Previous by thread: Re: Is pointer syntax logical?
  • Next by thread: Re: Is pointer syntax logical?
  • Index(es):
    • Date
    • Thread