From: edgar <edg...@cr...> - 2021-03-31 15:10:53
|
On 2021-03-31 13:32, John Peterson wrote: > Hi Edgar, > > Yes, clearly something like this will work: > > libmesh_example_requires_fun(bool (0), >> "TESTME", >> __FILE__, >> __LINE__); > > > but you then force the user to manually pass __FILE__ and __LINE__ to > every > invocation of the "libmesh_error_msg_fun" function. To me this makes it > not > very desirable/useful. > > There is also the issue of not being able to "stream" messages into a > function the same way that is possible with macros, for example we > often > write code like: > > libmesh_error_msg("Invalid shape function index i = " << i); > > which is very convenient. If I understand correctly, your original > issue > with the macros was that you could not properly "namespace" them, e.g. > libMesh::libmesh_error_msg() does not work, but I think this is a > relatively minor price to pay for the other conveniences that using a > macro > provides. > > -- > John Thank you for your answer. Yes, indeed. My initial situation was that I thought of the convenience of having a =namespace=, but as I mentioned (and I know the previous e-mail was long), there are some times when one needs an actual function. Fortunately, libMesh is a kitchen and anyone can prepare their own recipe :) . Thanks. |