[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 3/3] exec: use char* for pointer arithmetic
From: |
Alex Bennée |
Subject: |
Re: [PATCH 3/3] exec: use char* for pointer arithmetic |
Date: |
Thu, 20 Jun 2024 16:10:26 +0100 |
Daniel P. Berrangé <berrange@redhat.com> writes:
> On Tue, Jun 18, 2024 at 04:05:36PM -0700, Richard Henderson wrote:
>> On 6/18/24 15:46, Roman Kiryanov wrote:
>> > @@ -2839,7 +2839,7 @@ static inline uint8_t
>> > address_space_ldub_cached(MemoryRegionCache *cache,
>> > {
>> > assert(addr < cache->len);
>> > if (likely(cache->ptr)) {
>> > - return ldub_p(cache->ptr + addr);
>> > + return ldub_p((char*)cache->ptr + addr);
>>
>> We require "char *" with a space.
>>
>> With all of those fixed,
>> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
>>
>> PS: I'm annoyed that standards never adopted arithmetic on void *.
>
> NB, QEMU is explicitly *NOT* targetting the C standard, we are
> targetting the C dialect supported by GCC and CLang only. IOW,
> if they have well defined behaviour for arithmetic on void *,
> then we are free to use it.
It looks like GNU C does support it:
https://gcc.gnu.org/onlinedocs/gcc/Pointer-Arith.html
>
> With regards,
> Daniel
--
Alex Bennée
Virtualisation Tech Lead @ Linaro
Re: [PATCH 3/3] exec: use char* for pointer arithmetic, Paolo Bonzini, 2024/06/20