Artem Shinkarov schrieb:
On Fri, Sep 30, 2011 at 4:54 PM, Jakub Jelinek <ja...@redhat.com> wrote:

On Fri, Sep 30, 2011 at 04:48:41PM +0100, Artem Shinkarov wrote:

Most likely we can. The question is what do we really want to check
with this test. My intention was to check that a programmer can
statically get correspondence of the types, in a sense that sizeof
(float) == sizeof (int) and sizeof (double) == sizeof (long long). As
it seems my original assumption does not hold. Before using __typeof,
I would try to make sure that there is no other way to determine these
correspondences.

You can use preprocessor too, either just surround the whole test
with #if __SIZEOF_INT__ == __SIZEOF_FLOAT__ and similar,
or select the right type through preprocessor
#if __SIZEOF_INT__ == __SIZEOF_FLOAT__
#define FLOATCMPTYPE int
#elif __SIZEOF_LONG__ == __SIZEOF_FLOAT__
#define FLOATCMPTYPE long
#else
...
or __typeof, etc.

      Jakub

Ok, here is a patch which uses __typeof. Passes on x86_64.

Thanks, I will test on avr next week.

Johann


Artem.

Reply via email to