[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Passing C pointers through guile

From: Kjetil S. Matheussen
Subject: Re: Passing C pointers through guile
Date: Fri, 11 Jul 2008 15:12:57 +0200 (CEST)

On Fri, 11 Jul 2008, Greg Troxel wrote:

"Kjetil S. Matheussen" <address@hidden> writes:

Also, various types of non-gc pointers are stored in integers in
all of the rt-*.scm files in
and many others (xg.c, etc.). It would be horribly idiotic
to write smurf's for all of those, or at least a common smurf, when a
single integer is enough.

What fraction of these uses are actually correct?  Have people run this
code on Windows 64 (which is LLP64, but on which long is 32 bits),
sparc64, and alpha.

All of them are correct. The alternative would be messier code.
The code in question doesn't run on those platforms anyway,
since there's a lot of strict linux stuff. However, I don't
the storage of pointers in unsigned longs (which is a perfectly
legal thing to do if done correctly), would pose any problem
for running it on other hardware.

 I'm always worried when people store pointers in
integers - it's IMHO basically a wrong thing to do.

In many situations, like the one above, it's a perfectly fine thing
to do, and also the only sane option. Of course, you must know what you are doing.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]