c++ - Is usage of Default parameters healthy habit or a bad one? -
when should use default parameters? proper syntax , should not used? using them regularly or bad habit? affect efficiency?
only case can think of affects efficiency when include big default parameter it's not used of callers. example:
#include <iostream> void foo(std::ostream& out=std::cout) { out << "foo"; }
if none of callers use default parameter, , rest of program doesn't need <iostream>
have been included in vain, increasing executable size (and compilation time may or may not matter much).
Comments
Post a Comment