Quantcast
Viewing all articles
Browse latest Browse all 22145

Is there an alternative for visual C++ __declspec (property declaration attribute) in clang and gcc?

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.


Viewing all articles
Browse latest Browse all 22145

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>