There is a Microsoft specific extension, which makes it possible to define property getters and setters like this:
// declspec_property.cppstruct S { int i; void putprop(int j) { i = j; } int getprop() { return i; } __declspec(property(get = getprop, put = putprop)) int the_prop;};int main() { S s; s.the_prop = 5; return s.the_prop;}
Is there any way to define property declaration attribute with clang or gcc?If I search for __declspec
, all I find is __declspec(dllexport)
, but I am not looking for that.