Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Funarg problem
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
===Example=== The following [[Haskell (programming language)|Haskell]]-like [[pseudocode]] defines [[Function_composition_(computer_science)|function composition]]: {{sxhl|2=haskell|1=compose f g = λx → f (g x)}} <code>[[Lambda calculus|λ]]</code> is the operator for constructing a new function, which in this case has one argument, <code>x</code>, and returns the result of first applying <code>g</code> to <code>x</code>, then applying <code>f</code> to that. This λ function carries the functions <code>f</code> and <code>g</code> (or pointers to them) as internal state. The problem in this case exists if the compose function allocates the parameter variables <code>f</code> and <code>g</code> on the stack. When <code>compose</code> returns, the stack frame containing <code>f</code> and <code>g</code> is discarded. When the internal function <code>λx</code> attempts to access <code>g</code>, it will access a discarded memory area.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)