Hey, I am thinking about doing static analysis of file descriptor operations in Tartan[1], and for that I need a way to identify file descriptors in function parameters and return values (and properties and signal parameters too). I can think of two options for this: 1. An (fd) annotation which marks an integer as a file descriptor. 2. A new type, GFileDescriptor, defined as typedef int GFileDescriptor and applied to all the relevant APIs with a (type) annotation. Both options could be used with (transfer) to indicate ownership transfer of the FD. I think I’m favouring option 2 because file descriptors aren’t really integers in any of the normal senses — you can’t really do arithmetic on them, and any comparison between them (except equality) is useless. So as far as introspection is concerned, they shouldn’t be integers. I’d appreciate other people’s thoughts on this. I suspect that a feature like this could be used in bindings to automatically close open FDs when they go out of scope. Is that done already somehow? Philip [1]: http://people.collabora.com/~pwith/tartan/
Attachment:
signature.asc
Description: This is a digitally signed message part