Usenet.com

www.Usenet.com

Group Index

Comp Thread Archive from Usenet.com

<-- __Chronological__ --> <-- __Thread__ -->

Re: Is it legal that a function pointer to "function with default arguments"?



Dhruv wrote:
> On Tue, 02 Dec 2003 11:51:50 -0500, Ajax Chelsea wrote:
> 
> > 1, int (*f)(int a = 1);//is it legal?
> >
> 
> No, you may have default values only in the declarartion and/or definition
> of the function, and if they are their in both places, they need to be the
> same.

Default arguments must not be changed *or repeated* in a later declaration
(including a definition) in the same scope.  However, they can be *added*
in a later declaration and they can be changed in a declaration within a
different scope!  See 8.3.6/4.

      [ See http://www.gotw.ca/resources/clcm.htm for info about ]
      [ comp.lang.c++.moderated.    First time posters: Do this! ]



<-- __Chronological__ --> <-- __Thread__ -->


Usenet.com



Please check out one of the premium Usenet Newsgroup Service Providers below for access to Usenet.