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: Jean-Daniel Dupas <email@hidden>
- Date: Tue, 08 Apr 2014 16:29:54 +0200
Le 8 avr. 2014 à 16:25, Jens Alfke <email@hidden> a écrit :
>
> 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.
You can enable warning on pointer arithmetic:
-Wpointer-arith
_______________________________________________
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