Re: I thought void* arithmetic was not allowed
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