unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* nested defsubst?
@ 2015-08-10  3:10 Ian Zimmerman
  0 siblings, 0 replies; 2+ messages in thread
From: Ian Zimmerman @ 2015-08-10  3:10 UTC (permalink / raw)
  To: help-gnu-emacs

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?

-- 
Please *no* private copies of mailing list or newsgroup messages.
Rule 420: All persons more than eight miles high to leave the court.




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: nested defsubst?
       [not found] <mailman.8058.1439176228.904.help-gnu-emacs@gnu.org>
@ 2015-08-10  7:15 ` Barry Margolin
  0 siblings, 0 replies; 2+ messages in thread
From: Barry Margolin @ 2015-08-10  7:15 UTC (permalink / raw)
  To: help-gnu-emacs

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 ***


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-08-10  7:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-10  3:10 nested defsubst? Ian Zimmerman
     [not found] <mailman.8058.1439176228.904.help-gnu-emacs@gnu.org>
2015-08-10  7:15 ` Barry Margolin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).