What's the new style declaration ?
Trying to build this code in VS2019 gives me Error C2447 '{': missing function header (old-style formal list?) :-
Code:
static __cdecl void
unload_custom_fonts()
{
std::string font_file;
if (find_file (ardour_data_search_path(), "ArdourMono.ttf", font_file)) {
RemoveFontResource(font_file.c_str());
}
if (find_file (ardour_data_search_path(), "ArdourSans.ttf", font_file)) {
RemoveFontResource(font_file.c_str());
}
}
I can eliminate the error by removing the __cdecl bit - though presumably that's needed? I'm building as 64-bit and I've a vague recollection that all functions are cdecl now so will it be okay just to remove it? (it's possible that others might be building as 32-bit)
Re: What's the new style declaration ?
__cdecl goes after the return type and before the function name for VS.
Re: What's the new style declaration ?
Thanks for the reply 2kaud and sorry for the delay - I keep forgetting that this forum won't send notifications any more.
Re: What's the new style declaration ?
C++11 introduced a new way to declare variables known as "uniform initialization" or "uniform initializer syntax." This syntax provides a more concise and consistent way to initialize objects, and can also help prevent certain types of programming errors.
The new syntax uses curly braces {} to specify the initial value, instead of parentheses ():
java
// Old style initialization
int x(0);
// New style initialization
int x{0};
This syntax works with any type of object, including built-in types, user-defined types, and objects created with dynamic allocation. The exact behavior of this syntax depends on the type of object being initialized.
Re: What's the new style declaration ?
Yes - but the OP was regarding usage of __cdecl