[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: modifying pointers
From: |
Andy Wingo |
Subject: |
Re: modifying pointers |
Date: |
Fri, 09 Apr 2010 18:59:16 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.0.92 (gnu/linux) |
Hi,
On Fri 09 Apr 2010 18:30, address@hidden (Ludovic Courtès) writes:
> Andy Wingo <address@hidden> writes:
>
>> You added a change to foreign-set! for %null-pointer. Would it not make
>> sense instead to make foreign pointers of type "void" unsettable?
>
> Not necessarily. See the test that was added:
>
> (pass-if "foreign-set! other-null-pointer"
> (let ((f (bytevector->foreign (make-bytevector 2))))
> (and (not (= 0 (foreign-ref f)))
> (begin
> (foreign-set! f 0)
> (= 0 (foreign-ref f)))
> (begin
> ;; Here changing the pointer value of F is perfectly valid.
> (foreign-set! f 777)
> (= 777 (foreign-ref f))))))
>
> Here a ((void *) 777) pointer is created.
I'm just wondering if it is valid to create a ((void*) 777) pointer.
Under what condition is that useful?
If that is useful, OK; but under what condition is it useful to mutate
the pointer in a foreign pointer object? Why not create a new foreign
pointer object?
Andy
--
http://wingolog.org/