2011/8/7 Tom Lane <tgl@sss.pgh.pa.us>:
> Kohei KaiGai <kaigai@kaigai.gr.jp> writes:
>> I'm under implementation of this code according to the suggestion.
>> However, I'm not sure whether it is really portable way (at least, GCC accepts),
>> and whether the interface is simpler than as Robert suggested at first.
>
>> #define get_object_property_attnum_name(objtype) \
>> ({ AttrNumber ____temp; \
>> get_object_property((objtype), NULL, NULL, NULL, NULL, \
>> &____temp, NULL, NULL); \
>> ____temp; })
>
> Blocks within expressions are a gcc-ism and will fail on any other
> compiler, so you can't do it that way.
>
Thanks for your suggestion.
So, it seems to me the interface should return a pointer to the entry
of array being specified, rather than above approach.
E.g, the above macro could be probably rewritten as follows: #define get_object_property_attnum_name(objtype) \
(get_object_property(objtype)->attnum_name)
--
KaiGai Kohei <kaigai@kaigai.gr.jp>