[fetter-devel] wrong code generated

John Morrison morrison at mak.com
Fri Oct 28 21:12:40 UTC 2005


Sorry if a duplicate -- first try, sent originally from not-subscribed
email identity, bounced..

On Thursday 27 October 2005 02:36 pm, Kenny Tilton wrote:
> Sounds like CFFI needs an extension. What are other FFIs such as

That smells right to me, too.

> AllegroCL and CLisp doing?
>
> Will such a creature actually only work on a 64-bit system? If not, what
> do they become on 32-bit systems? Can they be treated benignly as 32-bit
> longs on 32-bit systems, failing only where runtime values actually
> exceed 32 bits? I am just hunting around for some imperfect solution
> that fails no more often than would using the library on a 32-but system
> even from a C client application.

For what it's worth, on a 32-bit AMD Linux system, it seems like "long
long" anything wants to be 8 bytes (see below)...

I do vaguely remember doing an embedded system (JVM for a bare iron
PC) where I ran into something like this, and I distantly recall
gcc/g++ treating long longs as 8 byte quantities, and relying on
runtime functions (libc?) to do operations on them (as opposed to
using single x86 instructions as there were no 8 byte operand capable
instructions available).  I also distantly recall I had to reimplement
them (licensing reasons).  Of course, that was a couple of years (and
several g++ revisions) ago.

--- cut here ---

[jm at jm4 tmp]$ cat sizes.cxx
#include "stdio.h"

int main(int argc, char *argv)
{
  printf("sizeof(long)=%d\n", sizeof(long));
  printf("sizeof(long long)=%d\n", sizeof(long long));
  printf("sizeof(long long int)=%d\n", sizeof(long long int));
  printf("sizeof(long long unsigned)=%d\n", sizeof(long long unsigned));
}
[jm at jm4 tmp]$ g++ -o sizes sizes.cxx
[jm at jm4 tmp]$ ./sizes
sizeof(long)=4
sizeof(long long)=8
sizeof(long long int)=8
sizeof(long long unsigned)=8
[jm at jm4 tmp]$

--- cut here ---

And the software I'm interested in bindings/calling via verrazano uses
these various types...

-jm

-- 
==== John Morrison
==== MAK Technologies Inc.
==== 10 Fawcett Street, Cambridge, MA 02138
==== http://www.mak.com/
==== vox:617-876-8085 x115
==== fax:617-876-9208
==== jm at mak.com





More information about the fetter-devel mailing list