
In contrast if I implement the code below, it will only work for __declspec and not for other extensions (because the lib needs to be aware of __declspec and not just of verbatim here):
CONTRACT_CLASS( __declspec(dllimport) class (x) ) { CONTRACT_CLASS_INVARIANT( void ) } varx;
CONTRACT_CLASS( class __declspec(dllimport) (x) ) { CONTRACT_CLASS_INVARIANT( void ) };
What do you think?
I think both are good. You should implement important known compiler extensions like __declspec and __attribute__ directly and also provide verbatim to handle unknown or future compiler extensions.
If implementing both is a viable option, I would agree with Steve. Otherwise, any of the two options works for me: I am only aware of two vendor specific extensions: __declspec and __attribute__ and it is only these two that I was interested in. - selfish as it sounds.