Default argument in C++

I am trying to develop a function LogMsg with a default argument. It seems that when I try to override the argument in a function call, the default argument value is still used. Does anyone encounter this issue?

My function is below, I am trying set the eventId is ArEventLog. The default argument is the severity:


void LogMsg(const char* strMsg, DINT severity=LOG_SEVERITY_WARNING);

I found the error which was due to my program. The ArEventLog program was not at the correct step and I stored the message to call again later. However I did not store the severity. After fixing it, the program works as expected and the default argument is working also.


And again, good that you found the issue. I think we have a lack of C++ programmers in the community, so please keep up. Looking forward for the information that your Programm will be finished. :slight_smile:

1 Like