On 6 November 2012 11:27, Thomas Preud'homme
<address@hidden> wrote:
Le mardi 6 novembre 2012 16:37:21, Thomas Preud'homme a écrit :
> Le mardi 6 novembre 2012 16:22:00, Milutin Jovanović a écrit :
> Sure, I agree I don't like it. It create a risk of forgetting it for the
> future. But accessors or bitfield doesn't change anything. Bitfield needs
> to shift the value to the left for each use and accessors need to be used
> for each case. Someone reading tcc.h will be tempted to use the field
> immediately. At least bitfield makes it more clear to the compiler what's
> going on but it will not catch a mistake such has reading the value
> directly from got_offset.
I went with bit fields in the end. I also modified put_got_offset so that a value
can be set twice. Although it's not needed now, put_got_offset could be used by
someone in this way later on and that would lead to subtle bugs.
> > Small stylistic issue is that I (personally) don't like '& -2' mask. I
> > think this obfuscates the intent, and the simple '& ~1' is more usual,
> > and it should not be any slower. -2 also assumes two's complement
> > implementations...
Hence gone :)
I'll appreciate another review if you have time. Thanks again.
Thomas