On 2013-01-06 14:29, Philippe Sigaud wrote:
I just want to be able to return an attributed something. How can a function return something that's attributed?IIUC what Walter said, a function cannot return an attributed value: any internal symbol can be attributed, but these cannot get out. I can create can attributed value to 'catch' what a function returns, but not automatically: ??? attributedInt() { @("Hello") int i = 1; return i; } void main() { ??? j = attributedInt(); // How to have j get the @("Hello") attribute? } The only way would be what you suggest: - extract the attributes from the internal i - store them in a specially-crafted struct - return that - in the external code, catch the returned struct - extract the artificially stored attributes - generate a new value with the same attributes.
Basically, yes. I haven't been able figured out something else. -- /Jacob Carlborg
