How to call a function with default parameter through a pointer to function that is the return of another function? Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern) Data science time! April 2019 and salary with experience The Ask Question Wizard is Live! Should we burninate the [wrap] tag?Howto: c++ Function Pointer with default valuesHow do function pointers in C work?How come pointer to a function be called without dereferencing?Pointer to a C++ class member function as a global function's parameter?What's an effective way to parse command line parameters in C++?Where to put default parameter value in C++?(char**)0 in C ++type of function pointerC Pass arguments as void-pointer-list to imported function from LoadLibrary()Calling function pointer from memory locationPassing parameters to function pointer
Why are there no cargo aircraft with "flying wing" design?
Is there a (better) way to access $wpdb results?
Using et al. for a last / senior author rather than for a first author
Denied boarding although I have proper visa and documentation. To whom should I make a complaint?
Seeking colloquialism for “just because”
Why did the Falcon Heavy center core fall off the ASDS OCISLY barge?
How do I mention the quality of my school without bragging
Echoing a tail command produces unexpected output?
What is the meaning of the new sigil in Game of Thrones Season 8 intro?
Withdrew £2800, but only £2000 shows as withdrawn on online banking; what are my obligations?
How to find out what spells would be useless to a blind NPC spellcaster?
Book where humans were engineered with genes from animal species to survive hostile planets
Why is my conclusion inconsistent with the van't Hoff equation?
Why do people hide their license plates in the EU?
Coloring maths inside a tcolorbox
Identify plant with long narrow paired leaves and reddish stems
Storing hydrofluoric acid before the invention of plastics
What are the pros and cons of Aerospike nosecones?
Why aren't air breathing engines used as small first stages
How do I stop a creek from eroding my steep embankment?
Do I really need recursive chmod to restrict access to a folder?
What does this icon in iOS Stardew Valley mean?
Can a non-EU citizen traveling with me come with me through the EU passport line?
What's the purpose of writing one's academic biography in the third person?
How to call a function with default parameter through a pointer to function that is the return of another function?
Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)
Data science time! April 2019 and salary with experience
The Ask Question Wizard is Live!
Should we burninate the [wrap] tag?Howto: c++ Function Pointer with default valuesHow do function pointers in C work?How come pointer to a function be called without dereferencing?Pointer to a C++ class member function as a global function's parameter?What's an effective way to parse command line parameters in C++?Where to put default parameter value in C++?(char**)0 in C ++type of function pointerC Pass arguments as void-pointer-list to imported function from LoadLibrary()Calling function pointer from memory locationPassing parameters to function pointer
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
I have a function Mult that takes two integers and returns the product of its parameters. And a function Double that takes an integer and returns a pointer to function that returns an integer and takes two integer parameters like Mult.
Mult's second parameter isdefaultSo when I callDouble,Doublereturns the address ofMultthus I can pass only one argument.
But It doesn't work with pointer to function:
int Mult(int x, int y = 2) // y is default
return x * y;
using pFn = int(*)(int, int);
pFn Double(int x)
return Mult;
int main(int argc, char* argv[])
pFn func = Double(0);
cout << func(7, 4) << endl; // ok
//cout << func(7) << endl; // error: Too few arguments
cout << Mult(4) << endl; // ok. the second argument is default
Above if I call Mult with a single argument it works fine because the second argument is default but calling it through the pointer func it fails. func is pointer to function that takes two integers and returns an int.
c++ function-pointers default-arguments
add a comment |
I have a function Mult that takes two integers and returns the product of its parameters. And a function Double that takes an integer and returns a pointer to function that returns an integer and takes two integer parameters like Mult.
Mult's second parameter isdefaultSo when I callDouble,Doublereturns the address ofMultthus I can pass only one argument.
But It doesn't work with pointer to function:
int Mult(int x, int y = 2) // y is default
return x * y;
using pFn = int(*)(int, int);
pFn Double(int x)
return Mult;
int main(int argc, char* argv[])
pFn func = Double(0);
cout << func(7, 4) << endl; // ok
//cout << func(7) << endl; // error: Too few arguments
cout << Mult(4) << endl; // ok. the second argument is default
Above if I call Mult with a single argument it works fine because the second argument is default but calling it through the pointer func it fails. func is pointer to function that takes two integers and returns an int.
c++ function-pointers default-arguments
1
What is the point ofDoubletaking an integer parameter that it doesn't use?
– scohe001
1 hour ago
1
Similar: Howto: c++ Function Pointer with default values
– TrebledJ
1 hour ago
@scohe001: In a real example It can do some stuff on it. (parameter).
– Syfu_H
5 mins ago
add a comment |
I have a function Mult that takes two integers and returns the product of its parameters. And a function Double that takes an integer and returns a pointer to function that returns an integer and takes two integer parameters like Mult.
Mult's second parameter isdefaultSo when I callDouble,Doublereturns the address ofMultthus I can pass only one argument.
But It doesn't work with pointer to function:
int Mult(int x, int y = 2) // y is default
return x * y;
using pFn = int(*)(int, int);
pFn Double(int x)
return Mult;
int main(int argc, char* argv[])
pFn func = Double(0);
cout << func(7, 4) << endl; // ok
//cout << func(7) << endl; // error: Too few arguments
cout << Mult(4) << endl; // ok. the second argument is default
Above if I call Mult with a single argument it works fine because the second argument is default but calling it through the pointer func it fails. func is pointer to function that takes two integers and returns an int.
c++ function-pointers default-arguments
I have a function Mult that takes two integers and returns the product of its parameters. And a function Double that takes an integer and returns a pointer to function that returns an integer and takes two integer parameters like Mult.
Mult's second parameter isdefaultSo when I callDouble,Doublereturns the address ofMultthus I can pass only one argument.
But It doesn't work with pointer to function:
int Mult(int x, int y = 2) // y is default
return x * y;
using pFn = int(*)(int, int);
pFn Double(int x)
return Mult;
int main(int argc, char* argv[])
pFn func = Double(0);
cout << func(7, 4) << endl; // ok
//cout << func(7) << endl; // error: Too few arguments
cout << Mult(4) << endl; // ok. the second argument is default
Above if I call Mult with a single argument it works fine because the second argument is default but calling it through the pointer func it fails. func is pointer to function that takes two integers and returns an int.
c++ function-pointers default-arguments
c++ function-pointers default-arguments
edited 1 hour ago
ShadowRanger
64.1k661101
64.1k661101
asked 1 hour ago
Syfu_HSyfu_H
1556
1556
1
What is the point ofDoubletaking an integer parameter that it doesn't use?
– scohe001
1 hour ago
1
Similar: Howto: c++ Function Pointer with default values
– TrebledJ
1 hour ago
@scohe001: In a real example It can do some stuff on it. (parameter).
– Syfu_H
5 mins ago
add a comment |
1
What is the point ofDoubletaking an integer parameter that it doesn't use?
– scohe001
1 hour ago
1
Similar: Howto: c++ Function Pointer with default values
– TrebledJ
1 hour ago
@scohe001: In a real example It can do some stuff on it. (parameter).
– Syfu_H
5 mins ago
1
1
What is the point of
Double taking an integer parameter that it doesn't use?– scohe001
1 hour ago
What is the point of
Double taking an integer parameter that it doesn't use?– scohe001
1 hour ago
1
1
Similar: Howto: c++ Function Pointer with default values
– TrebledJ
1 hour ago
Similar: Howto: c++ Function Pointer with default values
– TrebledJ
1 hour ago
@scohe001: In a real example It can do some stuff on it. (parameter).
– Syfu_H
5 mins ago
@scohe001: In a real example It can do some stuff on it. (parameter).
– Syfu_H
5 mins ago
add a comment |
2 Answers
2
active
oldest
votes
Defaulted arguments are a bit of C++ syntactic sugar; when calling the function directly with insufficient arguments, the compiler inserts the default as if the caller had passed it explicitly, so the function is still called with the full complement of arguments (Mult(4) is compiled into the same code as Mult(4, 2) in this case).
The default isn't actually part of the function type though, so you can't use the default for an indirect call; the syntactic sugar breaks down there, since as soon as you are calling through a pointer, the information about the defaults is lost.
add a comment |
For the "why not" I refer you to this answer. If you want to somehow keep the ability to use a default, you need to provide something more than a function pointer, eg a lamdba will do:
auto Double()
return [](int x,int y=2) return Mult(x,y); ;
And by using a variadic lambda (thanks to @Artyer) you do not even have to repeat the default value:
#include <iostream>
int Mult(int x, int y = 2) // y is default
return x * y;
auto Double()
return [](auto... args) return Mult(args...); ;
int main(int argc, char* argv[])
auto func = Double();
std::cout << func(7, 4) << 'n'; // ok
std::cout << func(7) << 'n'; // ok
std::cout << Mult(4) << 'n'; // ok
Live demo
Note that this involves repeating the default explicitly insideDoublewhen defining thelambda, which limits the utility significantly.
– ShadowRanger
59 mins ago
@ShadowRanger yes, added a note
– user463035818
54 mins ago
2
To not have to repeat the defaults, just forward variadic arguments:return [](auto... args) return Mult(args...);. Or with perfect forwarding (Which is not really necessary here because this just copiesints, but may be for other functions)return [](auto&&... args) noexcept(noexcept(Mult(std::forward<decltype(args)>(args)...))) -> decltype(auto) return Mult(std::forward<decltype(args)>(args)...); ;
– Artyer
50 mins ago
@Artyer thanks. didnt post the forwarding one, because I would have to understand it first myself and forints its not really worth the trouble
– user463035818
42 mins ago
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55716044%2fhow-to-call-a-function-with-default-parameter-through-a-pointer-to-function-that%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
Defaulted arguments are a bit of C++ syntactic sugar; when calling the function directly with insufficient arguments, the compiler inserts the default as if the caller had passed it explicitly, so the function is still called with the full complement of arguments (Mult(4) is compiled into the same code as Mult(4, 2) in this case).
The default isn't actually part of the function type though, so you can't use the default for an indirect call; the syntactic sugar breaks down there, since as soon as you are calling through a pointer, the information about the defaults is lost.
add a comment |
Defaulted arguments are a bit of C++ syntactic sugar; when calling the function directly with insufficient arguments, the compiler inserts the default as if the caller had passed it explicitly, so the function is still called with the full complement of arguments (Mult(4) is compiled into the same code as Mult(4, 2) in this case).
The default isn't actually part of the function type though, so you can't use the default for an indirect call; the syntactic sugar breaks down there, since as soon as you are calling through a pointer, the information about the defaults is lost.
add a comment |
Defaulted arguments are a bit of C++ syntactic sugar; when calling the function directly with insufficient arguments, the compiler inserts the default as if the caller had passed it explicitly, so the function is still called with the full complement of arguments (Mult(4) is compiled into the same code as Mult(4, 2) in this case).
The default isn't actually part of the function type though, so you can't use the default for an indirect call; the syntactic sugar breaks down there, since as soon as you are calling through a pointer, the information about the defaults is lost.
Defaulted arguments are a bit of C++ syntactic sugar; when calling the function directly with insufficient arguments, the compiler inserts the default as if the caller had passed it explicitly, so the function is still called with the full complement of arguments (Mult(4) is compiled into the same code as Mult(4, 2) in this case).
The default isn't actually part of the function type though, so you can't use the default for an indirect call; the syntactic sugar breaks down there, since as soon as you are calling through a pointer, the information about the defaults is lost.
answered 1 hour ago
ShadowRangerShadowRanger
64.1k661101
64.1k661101
add a comment |
add a comment |
For the "why not" I refer you to this answer. If you want to somehow keep the ability to use a default, you need to provide something more than a function pointer, eg a lamdba will do:
auto Double()
return [](int x,int y=2) return Mult(x,y); ;
And by using a variadic lambda (thanks to @Artyer) you do not even have to repeat the default value:
#include <iostream>
int Mult(int x, int y = 2) // y is default
return x * y;
auto Double()
return [](auto... args) return Mult(args...); ;
int main(int argc, char* argv[])
auto func = Double();
std::cout << func(7, 4) << 'n'; // ok
std::cout << func(7) << 'n'; // ok
std::cout << Mult(4) << 'n'; // ok
Live demo
Note that this involves repeating the default explicitly insideDoublewhen defining thelambda, which limits the utility significantly.
– ShadowRanger
59 mins ago
@ShadowRanger yes, added a note
– user463035818
54 mins ago
2
To not have to repeat the defaults, just forward variadic arguments:return [](auto... args) return Mult(args...);. Or with perfect forwarding (Which is not really necessary here because this just copiesints, but may be for other functions)return [](auto&&... args) noexcept(noexcept(Mult(std::forward<decltype(args)>(args)...))) -> decltype(auto) return Mult(std::forward<decltype(args)>(args)...); ;
– Artyer
50 mins ago
@Artyer thanks. didnt post the forwarding one, because I would have to understand it first myself and forints its not really worth the trouble
– user463035818
42 mins ago
add a comment |
For the "why not" I refer you to this answer. If you want to somehow keep the ability to use a default, you need to provide something more than a function pointer, eg a lamdba will do:
auto Double()
return [](int x,int y=2) return Mult(x,y); ;
And by using a variadic lambda (thanks to @Artyer) you do not even have to repeat the default value:
#include <iostream>
int Mult(int x, int y = 2) // y is default
return x * y;
auto Double()
return [](auto... args) return Mult(args...); ;
int main(int argc, char* argv[])
auto func = Double();
std::cout << func(7, 4) << 'n'; // ok
std::cout << func(7) << 'n'; // ok
std::cout << Mult(4) << 'n'; // ok
Live demo
Note that this involves repeating the default explicitly insideDoublewhen defining thelambda, which limits the utility significantly.
– ShadowRanger
59 mins ago
@ShadowRanger yes, added a note
– user463035818
54 mins ago
2
To not have to repeat the defaults, just forward variadic arguments:return [](auto... args) return Mult(args...);. Or with perfect forwarding (Which is not really necessary here because this just copiesints, but may be for other functions)return [](auto&&... args) noexcept(noexcept(Mult(std::forward<decltype(args)>(args)...))) -> decltype(auto) return Mult(std::forward<decltype(args)>(args)...); ;
– Artyer
50 mins ago
@Artyer thanks. didnt post the forwarding one, because I would have to understand it first myself and forints its not really worth the trouble
– user463035818
42 mins ago
add a comment |
For the "why not" I refer you to this answer. If you want to somehow keep the ability to use a default, you need to provide something more than a function pointer, eg a lamdba will do:
auto Double()
return [](int x,int y=2) return Mult(x,y); ;
And by using a variadic lambda (thanks to @Artyer) you do not even have to repeat the default value:
#include <iostream>
int Mult(int x, int y = 2) // y is default
return x * y;
auto Double()
return [](auto... args) return Mult(args...); ;
int main(int argc, char* argv[])
auto func = Double();
std::cout << func(7, 4) << 'n'; // ok
std::cout << func(7) << 'n'; // ok
std::cout << Mult(4) << 'n'; // ok
Live demo
For the "why not" I refer you to this answer. If you want to somehow keep the ability to use a default, you need to provide something more than a function pointer, eg a lamdba will do:
auto Double()
return [](int x,int y=2) return Mult(x,y); ;
And by using a variadic lambda (thanks to @Artyer) you do not even have to repeat the default value:
#include <iostream>
int Mult(int x, int y = 2) // y is default
return x * y;
auto Double()
return [](auto... args) return Mult(args...); ;
int main(int argc, char* argv[])
auto func = Double();
std::cout << func(7, 4) << 'n'; // ok
std::cout << func(7) << 'n'; // ok
std::cout << Mult(4) << 'n'; // ok
Live demo
edited 48 mins ago
answered 1 hour ago
user463035818user463035818
19.3k42971
19.3k42971
Note that this involves repeating the default explicitly insideDoublewhen defining thelambda, which limits the utility significantly.
– ShadowRanger
59 mins ago
@ShadowRanger yes, added a note
– user463035818
54 mins ago
2
To not have to repeat the defaults, just forward variadic arguments:return [](auto... args) return Mult(args...);. Or with perfect forwarding (Which is not really necessary here because this just copiesints, but may be for other functions)return [](auto&&... args) noexcept(noexcept(Mult(std::forward<decltype(args)>(args)...))) -> decltype(auto) return Mult(std::forward<decltype(args)>(args)...); ;
– Artyer
50 mins ago
@Artyer thanks. didnt post the forwarding one, because I would have to understand it first myself and forints its not really worth the trouble
– user463035818
42 mins ago
add a comment |
Note that this involves repeating the default explicitly insideDoublewhen defining thelambda, which limits the utility significantly.
– ShadowRanger
59 mins ago
@ShadowRanger yes, added a note
– user463035818
54 mins ago
2
To not have to repeat the defaults, just forward variadic arguments:return [](auto... args) return Mult(args...);. Or with perfect forwarding (Which is not really necessary here because this just copiesints, but may be for other functions)return [](auto&&... args) noexcept(noexcept(Mult(std::forward<decltype(args)>(args)...))) -> decltype(auto) return Mult(std::forward<decltype(args)>(args)...); ;
– Artyer
50 mins ago
@Artyer thanks. didnt post the forwarding one, because I would have to understand it first myself and forints its not really worth the trouble
– user463035818
42 mins ago
Note that this involves repeating the default explicitly inside
Double when defining the lambda, which limits the utility significantly.– ShadowRanger
59 mins ago
Note that this involves repeating the default explicitly inside
Double when defining the lambda, which limits the utility significantly.– ShadowRanger
59 mins ago
@ShadowRanger yes, added a note
– user463035818
54 mins ago
@ShadowRanger yes, added a note
– user463035818
54 mins ago
2
2
To not have to repeat the defaults, just forward variadic arguments:
return [](auto... args) return Mult(args...); . Or with perfect forwarding (Which is not really necessary here because this just copies ints, but may be for other functions) return [](auto&&... args) noexcept(noexcept(Mult(std::forward<decltype(args)>(args)...))) -> decltype(auto) return Mult(std::forward<decltype(args)>(args)...); ;– Artyer
50 mins ago
To not have to repeat the defaults, just forward variadic arguments:
return [](auto... args) return Mult(args...); . Or with perfect forwarding (Which is not really necessary here because this just copies ints, but may be for other functions) return [](auto&&... args) noexcept(noexcept(Mult(std::forward<decltype(args)>(args)...))) -> decltype(auto) return Mult(std::forward<decltype(args)>(args)...); ;– Artyer
50 mins ago
@Artyer thanks. didnt post the forwarding one, because I would have to understand it first myself and for
ints its not really worth the trouble– user463035818
42 mins ago
@Artyer thanks. didnt post the forwarding one, because I would have to understand it first myself and for
ints its not really worth the trouble– user463035818
42 mins ago
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55716044%2fhow-to-call-a-function-with-default-parameter-through-a-pointer-to-function-that%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
What is the point of
Doubletaking an integer parameter that it doesn't use?– scohe001
1 hour ago
1
Similar: Howto: c++ Function Pointer with default values
– TrebledJ
1 hour ago
@scohe001: In a real example It can do some stuff on it. (parameter).
– Syfu_H
5 mins ago