qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v3 05/45] windbg: added helper features


From: Paolo Bonzini
Subject: Re: [Qemu-devel] [PATCH v3 05/45] windbg: added helper features
Date: Tue, 28 Nov 2017 10:01:26 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0

On 28/11/2017 09:34, Peter Maydell wrote:
>>  #define FMT_ERR  "Error:%d"
>>
>>  #define UINT8_P(ptr) ((uint8_t *) (ptr))
>> -#define UINT32_P(ptr) ((uint32_t *) (ptr))
>> +#define UINT32_P(ptr) ((uint32_t *) (size_t) (ptr))
>>  #define PTR(var) UINT8_P(&var)
> Hiding casts behind macros like this doesn't seem worthwhile
> to me anyway -- all it's doing is obscuring what's going on.
> And casting an arbitrary pointer to a uint32_t* is somewhat
> alarming -- the alignment requirements may not be met.
> Chances are high that code using that macro is not correct.

And also, we already have ldb_p and ldl_*_p that do exactly what you
want (and give you an opportunity to specify the intended endianness,
probably little-endian).

Thanks,

Paolo



reply via email to

[Prev in Thread] Current Thread [Next in Thread]