As i started experimenting more in depth with C++1x features i ran into some thinking. For example when there is this construct
template<unsigned int N> unsigned int functionForTest(const char (&a)[N]);
and the usage of it like
functionForTest("Hello"); ---> const char [6]
functionForTest("Hello World") ---> const char [12];
then c++ ends up instantiating 2 functions with 2 different parameter types and that means increase in binary size if this function is used with different sizes. How efficient is that? Is it compiler specific? Isn't the traditional C-like array and size passing to function much more efficient here?
This is how i build g++ -std=c++17 -Xlinker -Map=output.map compilerDiffs.cpp -o test.exe
and thats a sample of the map file inspected to come to this conclusion
samples of Map file