[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Tinycc-devel] [ RFC] About packing two infos in a long v2
From: |
grischka |
Subject: |
Re: [Tinycc-devel] [ RFC] About packing two infos in a long v2 |
Date: |
Thu, 15 Nov 2012 18:34:51 +0100 |
User-agent: |
Thunderbird 2.0.0.23 (Windows/20090812) |
address@hidden wrote:
I already did a general function to store a value but I adopted a
different approach:
#define put_sym_attr(s,index,field,val) \
alloc_sym_attr(s, index); \
s->sym_attrs[index].field = val
where alloc_sym_attr is the old put_got_offset without the assignment
line at the end. See attached file for the full patch (only tested on
x86-64 so far, I'll try to compile it on arm later).
To my taste that macro with 4 args (and omitted ';') is a too clever
workaround to avoid letting alloc_sym_attr() return a value.
Compare
put_sym_attr(s1, sym_index, got_offset, s1->got->data_offset);
with
alloc_sym_attr(s1, sym_index)->got_offset = s1->got->data_offset;
Clearly the latter is better readable (since '=' is C for 'put') and
without the additional macro your patch will be shorter which is
what counts in the end. ;)
Also, in general, there is always an certain ugliness with 'void'
functions. Thus if a function can return some useful value, then it
should do so. Think of 'strcpy'. (In that sense and opposed to the
related GCC warning it is of course not wrong not to use a return
value.)
> + typeof(s1->sym_attrs) tab;
Is this C? Note that not just GCC and TCC might be used to compile
tcc. (E.g. more recent MS compilers from the VCExpress editions used
to work)
Thanks,
--- grischka
- Re: [Tinycc-devel] [ RFC] About packing two infos in a long v2, (continued)
- Re: [Tinycc-devel] [ RFC] About packing two infos in a long v2, Milutin Jovanović, 2012/11/07
- Re: [Tinycc-devel] [ RFC] About packing two infos in a long v2, Thomas Preud'homme, 2012/11/07
- Re: [Tinycc-devel] [ RFC] About packing two infos in a long v2, Daniel Glöckner, 2012/11/10
- Re: [Tinycc-devel] [ RFC] About packing two infos in a long v2, Thomas Preud'homme, 2012/11/10
- Re: [Tinycc-devel] [ RFC] About packing two infos in a long v2, Thomas Preud'homme, 2012/11/10
- Re: [Tinycc-devel] [ RFC] About packing two infos in a long v2, robotux, 2012/11/15
- Re: [Tinycc-devel] [ RFC] About packing two infos in a long v2, grischka, 2012/11/15
- Re: [Tinycc-devel] [ RFC] About packing two infos in a long v2, robotux, 2012/11/15
- Re: [Tinycc-devel] [ RFC] About packing two infos in a long v2, grischka, 2012/11/15
- Re: [Tinycc-devel] [ RFC] About packing two infos in a long v2, robotux, 2012/11/15
- Re: [Tinycc-devel] [ RFC] About packing two infos in a long v2,
grischka <=
- Re: [Tinycc-devel] [ RFC] About packing two infos in a long v2, Thomas Preud'homme, 2012/11/16
- Re: [Tinycc-devel] [ RFC] About packing two infos in a long v2, Thomas Preud'homme, 2012/11/16
- Re: [Tinycc-devel] [ RFC] About packing two infos in a long v2, grischka, 2012/11/17