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在这种情况下是一个有效的选择:) –
非常感谢您的帮助! –