On 09/04/2015 11:04, Peter Maydell wrote:
> We discussed this last time round, I think. Whether structs get
> passed in registers depends on the host CPU ABI/calling convention.

Because of C++, structs up to pointer size are in practice always passed
in registers.  64-bit structs may or may not.

The main advantage of structs is that it's impossible to mismatch the
parameter order.  That even trumps readability in my opinion.

I'm ambivalent, but I wouldn't mind at all using structs.

Paolo

>> > I find it more readable, you ca go:
>> >
>> > attrs.secure = 1;
>> > attrs.master_id = 0x77;
>> > if (!attrs.secure)
>> >
>> > instead of:
>> >
>> > attrs |= MEMTXATTRS_SECURE
>> > if (!(attrs & MEMTXATTRS_SECURE))
>> >
>> > etc...
>> >
>> > Or do you see any disadvantages with this?
> I prefer the traditional integer-and-bitops approach, then you
> know what you're getting everywhere...

Reply via email to