help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: nested defsubst?


From: Barry Margolin
Subject: Re: nested defsubst?
Date: Mon, 10 Aug 2015 02:15:50 -0500
User-agent: MT-NewsWatcher/3.5.3b3 (Intel Mac OS X)

In article <mailman.8058.1439176228.904.help-gnu-emacs@gnu.org>,
 Ian Zimmerman <itz@buug.org> wrote:

> Is it useful?  That is, if I do this:
> 
> (defsubst foo ()
>   "foo")
> 
> (defsubst foobar ()
>   (concat (foo) "bar"))
> 
> will foobar contain an inlined copy of foo, _and_ will subsequent calls
> to foobar be inlined?

Yes to both.

To determine this, compile them and then use M-x disassemble to see 
whether it's inlined.

(defun use-foobar () (foobar))

M-x compile-defun

M-x disassemble use-foobar

byte code for use-foobar:
  args: nil
0       constant  "foo"
1       constant  "bar"
2       concat2   
3       return

-- 
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***


reply via email to

[Prev in Thread] Current Thread [Next in Thread]