CMFCPopupMenu* PopupMenuFolders = new CMFCPopupMenu();
//Mi serve controllare prima che esce il menu per eventualmente eliminare voci del menu non permesse.
PopupMenuFolders->InsertItem(CMFCToolBarMenuButton(ID_POPUP_FOLDERS_TREE_1, NULL, 0, _T("Item 1")));
PopupMenuFolders->InsertItem(CMFCToolBarMenuButton(ID_POPUP_FOLDERS_TREE_2, NULL, 1, _T("Item 2")));
PopupMenuFolders->InsertItem(CMFCToolBarMenuButton(ID_POPUP_FOLDERS_TREE_3, NULL, 2, _T("Item 3")));
PopupMenuFolders->Create(this, point.x, point.y, NULL);
What is a current C ( ANSI C) standard on putting <b>optional</b> parameters / attributes into function?
Or is there such a thing - ANSI standard _ anymore?
"Popular" microprocessor compiler does not allow such thing and "workaround" is function overloading.
Which IMHO in memory limited device adding more similar functions into code does not make much sense, unless you are memory chips salesman.
Thanks, but I may have messed up my question.
What I was looking for - is this syntax ANSI C standard
function(int a, int b = 0)
Where passing the second parameter in function call is optional.
Now I am totally lost.
I thought overloading was having same function name with different types of variables.
That works fine in Arduino C++ compiler.( And right now I have a bug in my code because I am using it).
I am assuming Arduino compiler is C++, did not really try to find out.
But since it works with classes....it must be C++ based.
void TestFunctionA (int a, int b = 100)
a += 1;
b += 10;
void TestFunctionB (int a)
a += 1;
// b += 10;
TestFunctionB (10); // int a, int b = 100)
And the compiler said too many arguments in function call
But if I change the b to float it compiles and it does makes sense to me. Partially.
If the b parameter b is not passed, than the function A will be executed and compiled.
But that was not the reason I asked. In "real" C compiler when a parameter is declared optional the code will compile without having to change all function calls to include the optional parameter.
But I still do not know if that is ANY standard or just MS compiler specific.
But Arduino compiler expects the "optional" parameter, so it is really not optional.