From: Stas B. <sta...@gm...> - 2017-03-19 17:11:17
|
Well, it's a recursive function, it'll want to inline itself again. On Sun, Mar 19, 2017 at 8:06 PM, Will Senn <wil...@gm...> wrote: > OK. I see the first two points, but why is inlining not good? > > On 3/19/17 12:03 PM, Stas Boukarev wrote: > > Well, the warning actually gives you directions for inlining. > And it doesn't complain after recompiling because it complains only once. > And inlining a recursive function will end badly. > > On Sun, Mar 19, 2017 at 7:51 PM, Will Senn <wil...@gm...> wrote: > >> Hi, >> >> How do I save a function so that it doesn't generate a warning about the >> function not being inlined because it hasn't been saved? >> >> on first entering SBCL: >> >> (defun sum (n1 n2) >> (declare (inline sum)) >> (declare (optimize (debug 3))) >> (if (zerop n1) n2 >> (sum (1- n1) (1+ n2)))) >> >> ; >> ; caught STYLE-WARNING: >> ; Call to COMMON-LISP-USER::SUM could not be inlined because its >> source code was >> ; not saved. A global INLINE or SB-EXT:MAYBE-INLINE proclamation must >> be in >> ; effect to save function definitions for inlining. >> ; >> ; compilation unit finished >> ; caught 1 STYLE-WARNING condition >> >> SUM >> >> on redefinition of sum, it doens't complain about not being about >> inlining, why? >> >> Thanks, >> >> Will >> >> -- >> GPG Fingerprint: 208A 38D6 D1BF 5A6B 7F4D CC0D 21CB 91B3 21E5 671F >> >> >> ------------------------------------------------------------ >> ------------------ >> Check out the vibrant tech community on one of the world's most >> engaging tech sites, Slashdot.org! http://sdm.link/slashdot >> _______________________________________________ >> Sbcl-help mailing list >> Sbc...@li... >> https://lists.sourceforge.net/lists/listinfo/sbcl-help >> > > > > -- > With best regards, Stas. > > > -- > GPG Fingerprint: 208A 38D6 D1BF 5A6B 7F4D CC0D 21CB 91B3 21E5 671F > > -- With best regards, Stas. |