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

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

[Octave-bug-tracker] [bug #55523] default argument of anonymous function


From: John W. Eaton
Subject: [Octave-bug-tracker] [bug #55523] default argument of anonymous function is not bound to value of local variable
Date: Fri, 15 May 2020 16:25:29 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Firefox/68.0

Follow-up Comment #8, bug #55523 (project octave):

In C++, the initialization value can be the result of a function call or a
global variable.  But, of course, global variables have much different
semantics in C++.

https://en.cppreference.com/w/cpp/language/default_arguments:

The names used in the default arguments are looked up, checked for
accessibility, and bound at the point of declaration, but are executed at the
point of the function call...

In any case, I agree that it is probably best to be conservative here and only
accept constants as initialization values.

    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?55523>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

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