[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 19:22:32 +0200 (CEST)

Ludovic Court?s:
"Kjetil S. Matheussen" <address@hidden> writes:

The code in question doesn't run on those platforms anyway,
since there's a lot of strict linux stuff.

You are certainly aware that GNU/Linux *is* available on sparc64, alpha,

Well, yes, but he wrote windows 64, sparc64, alpha etc.

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.

Again, it's not "perfectly legal", no matter whether you do it
"correctly" (whatever that means) or not: the C standard makes no
provision regarding the size of `long' versus the size of pointer types.
It happens to work on the mainstream platforms you're using, but it's
definitely not portable.

And I suppose that's the reason why you want `scm_{to,from}_uintptr ()'
in the first place, otherwise you'd just live (dangerously) with
`scm_{to,from}_unsigned_long ()'.

Yes, and this is a stupid discussion. We don't really disagree about anything unless anyone thinks I should change all my code using
scheme numbers to hold pointers into SMOB's, which would significantly
increase the code size which further would increase the chance of bugs.
There are, as I have given examples of already, types of pointer
where SMOB's are overkill. And just for trying out smaller things,
it a lot of work to set up all that SMOB code (again!). I do a lot
of interaction between C and scheme, and avoiding SMOBs as much
as possible saves me a lot of time.

reply via email to

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