如何解决sbcl 注意“无法堆栈分配”
为什么 sbcl (2.0.11) 给出这些编译器注释?这是否意味着这不是一种有效的方法?有什么你可以做的事情来堆栈分配谓词和键吗?或者另一种方法更好?
(defun sort-on-car (x)
(sort x #'> :key #'car))
; in: DEFUN SORT-ON-CAR
; (SORT PLAGE::X #'> :KEY #'CAR)
;
; note: could not stack allocate SB-IMPL::PREDICATE-FUN in: (SORT X #'> :KEY #'CAR)
;
; note: could not stack allocate SB-IMPL::KEY in: (SORT X #'> :KEY #'CAR)
;
; note: could not stack allocate SB-IMPL::PREDICATE-FUN in: (SORT X #'> :KEY #'CAR)
;
; note: could not stack allocate SB-IMPL::KEY in: (SORT X #'> :KEY #'CAR)
;
; compilation unit finished
; printed 4 notes
最小可重复示例,应要求提供。该文件仅包含上面的函数定义。
$ /usr/bin/sbcl --no-sysinit --no-userinit
This is SBCL 2.0.11,an implementation of ANSI Common Lisp.
More information about SBCL is available at <http://www.sbcl.org/>.
SBCL is free software,provided as is,with absolutely no warranty.
It is mostly in the public domain; some portions are provided under
BSD-style licenses. See the CREDITS and COPYING files in the
distribution for more information.
* (compile-file "/tmp/sortwarning.lisp")
; compiling file "/tmp/sortwarning.lisp" (written 13 JAN 2021 09:50:06 AM):
; processing (DEFUN SORT-ON-CAR ...)
; file: /tmp/sortwarning.lisp
; in: DEFUN SORT-ON-CAR
; (SORT X #'> :KEY #'CAR)
;
; note: could not stack allocate SB-IMPL::PREDICATE-FUN in: (SORT X #'> :KEY #'CAR)
;
; note: could not stack allocate SB-IMPL::KEY in: (SORT X #'> :KEY #'CAR)
;
; note: could not stack allocate SB-IMPL::PREDICATE-FUN in: (SORT X #'> :KEY #'CAR)
;
; note: could not stack allocate SB-IMPL::KEY in: (SORT X #'> :KEY #'CAR)
;
; compilation unit finished
; printed 4 notes
; wrote /tmp/sortwarning.fasl
; compilation finished in 0:00:00.050
#P"/tmp/sortwarning.fasl"
NIL
NIL
*
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。