From: Jeff Garzik <jeff@garzik.org>
To: Colin McCabe <cmccabe@alumni.cmu.edu>
Cc: Project Hail List <hail-devel@vger.kernel.org>,
Pete Zaitcev <zaitcev@redhat.com>
Subject: Re: [PATCH] tabled: use LL to indicate 64-bit constant
Date: Tue, 12 Jan 2010 14:24:25 -0500 [thread overview]
Message-ID: <4B4CCC69.8040904@garzik.org> (raw)
In-Reply-To: <436f52801001121025w57fc95cfn88c36f9ab5f5ee89@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 859 bytes --]
On 01/12/2010 01:25 PM, Colin McCabe wrote:
> util.c: In function ‘objid_init’:
> util.c:331: warning: integer constant is too large for ‘long’ type
>
> with
>
> [cmccabe@stargazer tabled]$ gcc --version
> gcc (GCC) 4.4.1 20090725 (Red Hat 4.4.1-2)
>
> Now that I wrote a little test program, I can see that gcc handles the
> constant correctly. It still issues a warning for some reason.
> I guess gcc's C99 support is not perfect.
Is this on a 32-bit on 64-bit compiler platform?
Because Linux does
#if __WORDSIZE == 64
typedef unsigned long int uint64_t;
#else
__extension__
typedef unsigned long long int uint64_t;
#endif
which causes the comparison type (uint64_t objcount) to vary between
32-bit and 64-bit platforms, even if the number of bits used to store it
remains the same.
Strange...
Jeff
[-- Attachment #2: x.c --]
[-- Type: text/plain, Size: 832 bytes --]
#include <stdlib.h>
#include <unistd.h>
#include <stdio.h>
#include <stdint.h>
#if 1
#define X 0xff00000000000000
#else
#define X x
#endif
int main (int argc, char *argv[])
{
uint32_t x = 0;
if (__builtin_types_compatible_p (typeof (X), int))
printf("type: int\n");
else if (__builtin_types_compatible_p (typeof (X), unsigned int))
printf("type: unsigned int\n");
else if (__builtin_types_compatible_p (typeof (X), long))
printf("type: long\n");
else if (__builtin_types_compatible_p (typeof (X), unsigned long))
printf("type: unsigned long\n");
else if (__builtin_types_compatible_p (typeof (X), long long))
printf("type: long long\n");
else if (__builtin_types_compatible_p (typeof (X), unsigned long long))
printf("type: unsigned long long\n");
else
printf("type: unknown\n");
(void) x;
return 0;
}
next prev parent reply other threads:[~2010-01-12 19:24 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-10 13:10 [PATCH] tabled: use LL to indicate 64-bit constant Colin McCabe
2010-01-12 2:51 ` Jeff Garzik
2010-01-12 14:29 ` Jeff Garzik
2010-01-12 18:25 ` Colin McCabe
2010-01-12 19:24 ` Jeff Garzik [this message]
2010-01-12 19:57 ` Colin McCabe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4B4CCC69.8040904@garzik.org \
--to=jeff@garzik.org \
--cc=cmccabe@alumni.cmu.edu \
--cc=hail-devel@vger.kernel.org \
--cc=zaitcev@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.