我無法找到如何製作C風格的聯盟。在documentation中給出的示例中:如何製作C風格的聯盟
(define a-union-type
(_union (_list-struct _int _int)
(_list-struct _double _double)))
(define a-union-val
(cast (list 3.14 2.71)
(_list-struct _double _double)
a-union-type))
所有的作品。但是,如果是投改爲_INT:
(define a-union-val
(cast (list 3 2)
(_list-struct _int _int)
a-union-type))
我獲得以下錯誤:
cast: representation sizes of from and to types differ
size of from type: 8
size of to size: 16
這在某種程度上是有道理的,但問題是,如何建立這個聯盟?
你能解釋一下make-union-type和_union之間的區別嗎?由於我不清楚從文檔。
非常感謝。
3.14和2.71不是'int's –
是的,但這裏不是問題...編輯。 – Ondrej