我有以下代码:
LISP car(LISP x)
{
switch TYPE(x)
{
case tc_nil:
return(NIL);
case tc_cons:
return(CAR(x));
default:
return(err("wrong type of argument to car",x));}}
}
};
我想知道更多关于“x”到底是什么。 我想做的第一件事是在“x”周围加上引号,这样它就会告诉我:
wrong type of argument to car: "garbage"
我想知道“x”是什么类型,它的值是多少。 但我什至没有编译它。
我已经尝试了我能想到的一切,但没有帮助。
LISP car(LISP x)
{
switch (TYPE(x))
{
case tc_nil:
return NIL;
case tc_cons:
return CAR(x);
default:
std::ostringstream ss;
ss << "wrong type of argument to car: type=" << TYPE(x) << ", value=" << get_c_string(x);
return err(ss.str().c_str());
}
}
我很抱歉没有发布告诉我得到了哪个错误,因为每次我尝试新的东西,我都会得到另一个错误。
编辑: 我不知道我使用的是哪个编译器。我只是在运行构建脚本。
这个声明有帮助吗?
#包括 #include "siod.h" #include "siodp.h" #包括
static LISP llength(LISP obj)
{LISP l;
long n;
switch TYPE(obj)
{case tc_string:
return(flocons(obj->storage_as.string.dim));
case tc_double_array:
return(flocons(obj->storage_as.double_array.dim));
case tc_long_array:
return(flocons(obj->storage_as.long_array.dim));
case tc_lisp_array:
return(flocons(obj->storage_as.lisp_array.dim));
case tc_nil:
return(flocons(0.0));
case tc_cons:
for(l=obj,n=0;CONSP(l);l=CDR(l),++n) INTERRUPT_CHECK();
if NNULLP(l) err("improper list to length",obj);
return(flocons(n));
default:
return(err("wrong type of argument to length",obj));}}