Comment 3 for bug 1369626

Revision history for this message
Andrew Johnson (anj) wrote :

If I've understood you correctly, that *would* cause a behavior change because ca_array_put_callback() triggers the dbNotify mechanism on the IOC whereas ca_array_put() does not. The CAref documentation says nothing about what is supposed to happen if pfunc is NULL.

I don't know what if anything actually changed, I suspect it may be that our current C++ compilers no longer bother to check for a NULL function pointer before calling it because that would be Undefined Behaviour, and if you trigger that you're on your own. Just because it used to work if you passed a NULL doesn't mean it was legal even then.

As I said before, I see no point in allowing a NULL callback function to ca_array_get_callback(), so I think that should return an error. For ca_array_put_callback() I could go either way, but if we allow it I think it should still trigger the dbNotify mechanism in the IOC — I'm pretty sure it used to do that, so to keep the original behavior we just have to remove the check that my patch adds to that function and rely on the new test in putCallback.cpp instead.