0
狡詐的化妝C-結構的不明原因的行爲接受以下代碼:狡詐的(系統外國)
(define ptr (make-c-struct '(int int) '(300 43)))
:
(use-modules (system foreign))
(define ptr (make-c-struct (list int int) '(300 43)))
然而,它拋出一個錯誤時,第二行被替換
有人能夠推斷出問題所在?
$ guile --version
guile (GNU Guile) 2.0.13
$ uname -a
Linux <host> 4.8.0-1-amd64 #1 SMP Debian 4.8.5-1 (2016-10-28) x86_64 GNU/Linux
Backtrace:
In ice-9/boot-9.scm:
160: 8 [catch #t #<catch-closure 55b8628b8600> ...]
In unknown file:
?: 7 [apply-smob/1 #<catch-closure 55b8628b8600>]
In ice-9/boot-9.scm:
66: 6 [call-with-prompt prompt0 ...]
In ice-9/eval.scm:
432: 5 [eval # #]
In ice-9/boot-9.scm:
2404: 4 [save-module-excursion #<procedure 55b8628d89c0 at ice-9/boot-9.scm:4051:3()>]
4058: 3 [#<procedure 55b8628d89c0 at ice-9/boot-9.scm:4051:3()>]
In /home/<user>/path/tofile.scm:
7: 2 [#<procedure 55b862cf46c0()>]
In system/foreign.scm:
158: 1 [make-c-struct (int int) (300 43)]
In unknown file:
?: 0 [sizeof (int int)]
ERROR: In procedure sizeof:
ERROR: In procedure alignof: Wrong type argument in position 1: int
謝謝奧斯卡,我應該知道的更好。我習慣於使用'(...)(帶有文字而不是變量),錯誤地認爲它是(list ...)的快捷方式。 Quasiquotes'\'(,int,int)'雖然很好,對嗎? –
是的,quasiquoting在這種情況下是一個有效的選擇:) –
非常感謝您的幫助! –