Topic: Can a default parameter be a static function call?


Author: Paul Black <nobody@vf.vodafone.co.uk>
Date: 1997/05/19
Raw View
jrwinter@mtu.edu (Jeffrey R. Winters) wrote:
 > Can a default parameter be a static function call?
 > For example:
 >
 > int DefaultFromFile();
 >
 > class Object
 > {
 >     public:
 >         static Object* Create(int value = DefaultFromFile());
 > };
 >
 >
 > I've seen a compiler that supports this mechanism and another that does not.
 > Any reasons why this should be disallowed?  What is the standard?

They are allowed. There is an example in section 8.3.6 para. 5.

--
Paul Black
Home:   paul@darwin.demon.co.uk
Work:   paul.black@vf.vodafone.co.uk
---
[ comp.std.c++ is moderated.  To submit articles: try just posting with      ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu         ]
[ FAQ:      http://reality.sgi.com/employees/austern_mti/std-c++/faq.html    ]
[ Policy:   http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
[ Comments? mailto:std-c++-request@ncar.ucar.edu                             ]





Author: jrwinter@mtu.edu (Jeffrey R. Winters)
Date: 1997/05/17
Raw View
Can a default parameter be a static function call?
For example:

int DefaultFromFile();

class Object
{
    public:
        static Object* Create(int value = DefaultFromFile());
};


I've seen a compiler that supports this mechanism and another that does not.
Any reasons why this should be disallowed?  What is the standard?


Thanks,


Jeff Winters
jrwinter@mtu.edu
---
[ comp.std.c++ is moderated.  To submit articles: try just posting with      ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu         ]
[ FAQ:      http://reality.sgi.com/employees/austern_mti/std-c++/faq.html    ]
[ Policy:   http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
[ Comments? mailto:std-c++-request@ncar.ucar.edu                             ]