octave-bug-tracker
[Top][All Lists]
Advanced

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

[Octave-bug-tracker] [bug #35472] inline function can't handle structure


From: Rik
Subject: [Octave-bug-tracker] [bug #35472] inline function can't handle structure.element references
Date: Thu, 09 Feb 2012 18:33:30 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:5.0) Gecko/20100101 Firefox/5.0

Follow-up Comment #2, bug #35472 (project octave):

I neglected to mention that there is a simple workaround: Use anonymous
functions.  Anonymous functions are faster than inline ones anyways and are a
better choice generally for code.

Example:


octave:1> func = @(FF) [ FF.a FF.b ] ;
octave:2> func
func =

@(FF) [FF.a, FF.b]

octave:3> x.a = 1
x =

  scalar structure containing the fields:

    a =  1

octave:4> x.b = 3
x =

  scalar structure containing the fields:

    a =  1
    b =  3

octave:5> func (x)
ans =

   1   3




    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?35472>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

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