Path: utzoo!censor!geac!torsqnt!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!usc!ucsd!ames!bionet!agate!linus!linus!stoney!djb From: djb@stoney.mitre.org (David J. Braunegg) Newsgroups: comp.lang.lisp Subject: AKCL declarations Message-ID: <127126@linus.mitre.org> Date: 5 Dec 90 15:38:54 GMT Sender: usenet@linus.mitre.org Organization: The MITRE Corporation Lines: 78 Does anyone know how to make declarations in AKCL work? I looked at the code in the .c file for the following four functions, and they were all the same. (defun test1 (x) (* x x)) (defun test2 (x) (declare (fixnum x)) (* x x)) (defun test3 (x) (the fixnum (* x x))) (defun test4 (x) (declare (fixnum x)) (the fixnum (* x x))) The C code is shown below. I would have at least expected #2 to produce code using int instead of object for V1. static L1() {register object *base=vs_base; register object *sup=base+VM1; VC1 vs_check; {object V1; V1=(base[0]); vs_top=sup; TTL:; base[1]= number_times((V1),(V1)); vs_top=(vs_base=base+1)+1; return; } } Likewise, the following four functions produced the same C code; (proclaim '(ftype (function (fixnum) fixnum) test5)) (defun test5 (x) (* x x)) (proclaim '(ftype (function (fixnum) fixnum) test6)) (defun test6 (x) (declare (fixnum x)) (* x x)) (proclaim '(ftype (function (fixnum) fixnum) test7)) (defun test7 (x) (the fixnum (* x x))) (proclaim '(ftype (function (fixnum) fixnum) test8)) (defun test8 (x) (declare (fixnum x)) (the fixnum (* x x))) The C code this time included int declarations for the function and arg, but rather than accepting that the arguments and result would be fixnum, explicitly converted them to fixnums using CMPmake_fixnum. (I guess the fix operation on the result in case the result got too large.) static int LI5(V6) int V6; { VMB5 VMS5 VMV5 TTL:;{object V7; V7= CMPmake_fixnum(V6);{object V8; V8= CMPmake_fixnum(V6); VMR5(fix(number_times(V7,V8)))}} } Brought to you by Super Global Mega Corp .com