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: Roland King <email@hidden>
- Date: Tue, 08 Apr 2014 21:10:36 +0800
On 8 Apr, 2014, at 9:05 pm, Keary Suska <email@hidden> wrote:
> 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.
>
>
good point - they are all void*s or const void *s in this case, they come from iterating around dispatch_data_t.
will make a decent case and file.
Thanks.
_______________________________________________
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