|
Re: [isQuery=true] property on passive class function does not reflect on source file [message #1795517 is a reply to message #1795449] |
Mon, 24 September 2018 15:54 |
Ernesto Posse Messages: 438 Registered: March 2011 |
Senior Member |
|
|
Hi. I'm not sure what you mean by "isQuery" on a class. "isQuery" is an attribute of operations (i.e. methods) only. But you are right about the generated code being incorrect. In fact we already have a bugzilla entry for it: Bug 528160.
Unfortunately the only workarounds for now are:
1) Manually add the const to the method signature in the generated code, but this will be removed if you re-generate code,
2) Apply the PassiveClassProperties stereotype to the class and use one of the <X>Declarations properties (privateDeclarations, protectedDeclarations, publicDeclarations) to add the full method, including its signature with const
Note however, that the "const" qualifier applied to a method means that in the method's body the 'this' pointer is treated as const, and you can only call const member functions in theory, but being C++, you can always "break the law" and also call non-const functions with a const_cast [1]. So the const qualifier doesn't do all that much. It may be used by the compiler to do some optimizations, but not much else. So, as long as you are disciplined in the method's implementation, it shouldn't matter all that much. In general, one can live without it.
[1] https://en.cppreference.com/w/cpp/language/member_functions#const-.2C_volatile-.2C_and_ref-qualified_member_functions
|
|
|
|
Powered by
FUDForum. Page generated in 0.32108 seconds