• 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: I thought void* arithmetic was not allowed
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: I thought void* arithmetic was not allowed


  • Subject: Re: I thought void* arithmetic was not allowed
  • From: Jens Alfke <email@hidden>
  • Date: Tue, 08 Apr 2014 07:25:06 -0700


On Apr 8, 2014, at 6:05 AM, Keary Suska <email@hidden> wrote:

As long as base_ptr is not a void * the compiler may have sufficient information to perform proper pointer arithmetic. Otherwise, I would expect it to be an error and you may want to file a bug report.

Nope. Arithmetic on void* pointers is a longstanding extension to C that began in GCC and is supported by Clang. For the purposes of this arithmetic the pointer’s item size is treated as 1 byte, as though it were a char*.

I personally find this very useful. I’m not sure how to turn it off, but there’s probably a compiler flag to do so.

—Jens
 _______________________________________________
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: I thought void* arithmetic was not allowed
      • From: Roland King <email@hidden>
    • Re: I thought void* arithmetic was not allowed
      • From: Jean-Daniel Dupas <email@hidden>
References: 
 >I thought void* arithmetic was not allowed (From: Roland King <email@hidden>)
 >Re: I thought void* arithmetic was not allowed (From: Keary Suska <email@hidden>)

  • Prev by Date: Re: Global Search Question
  • Next by Date: Re: I thought void* arithmetic was not allowed
  • Previous by thread: Re: I thought void* arithmetic was not allowed
  • Next by thread: Re: I thought void* arithmetic was not allowed
  • Index(es):
    • Date
    • Thread