• 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: Keary Suska <email@hidden>
  • Date: Tue, 08 Apr 2014 07:05:54 -0600

On Apr 8, 2014, at 6:38 AM, Roland King <email@hidden> wrote:

> I managed to end up with a piece of code which, distilled down, looks like this
>
> 	void *ptr       = base_ptr;
> 	void *other_ptr = ptr + 3;
>
> when debugging through the code I used the expression evaluator in lldb to evaluate "ptr+3" and I got an error message that arithmetic on void pointers is disallowed .. and I seem to remember it IS disallowed, in C at least.
>
> But I get no warning on that line. Is there a warning flag I'm missing here? clang compiles it without warning or error, LLDB refuses to evaluate it, one of them is right, which?

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.

Keary Suska
Esoteritech, Inc.



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

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