the number of actual arguments

in the following codes,
the number of actual arguments doesn't respect that of formal arguments
is it correct or not?
I'm sure there is no function overloading in the source codes

 
VideoStream::add_callback(&reset_stats, firstID);


1
2
void VideoStream::add_callback(void (*func)(size_t chunk_num), size_t chunk_num, bool repeats) {
	callbacks.push_back(VideoStreamCallback(func, chunk_num, repeats));
you are missing the last argument ( bool repeats )
those codes are written by other experienced programmers
so I want to make sure whether there are some mistakes or not
So far as I know , in the STL
such arguments as comp, allocator needn't be specified in the functions' arguments list when the functions are called

1
2
3
4
5
6
7

explicit set ( const Compare& comp = Compare(),
               const Allocator& = Allocator() );
template <class InputIterator>
  set ( InputIterator first, InputIterator last,
        const Compare& comp = Compare(), const Allocator& = Allocator() );
set ( const set<Key,Compare,Allocator>& x );
closed account (z05DSL3A)
The example given, set ( const Compare& comp = Compare(), const Allocator& = Allocator() ); has default arguments (the = Compare() and = Allocator() bits), so if neither are supplied the default argument is used.

See: Default values in parameters.
http://www.cplusplus.com/doc/tutorial/functions2/
Last edited on
Topic archived. No new replies allowed.