
John Torjo wrote:
I really wish there were exception-throwing versions -- since that code is boring and still contains a couple of error-handling problems. However, most of the functions above are acutally from POSIX, not from standard C, so I'm not sure how much wrapped C functions would help me.
Unless I'm mistaken, you're talking something similar to Andrei Alexandrescu's ENFORCE: http://www.cuj.com/documents/s=8250/cujcexp2106alexandr/
Yes, you're right. However, there's one additional wish -- I'd like an appraoch different macroses for different functions. E.g. for POSIX calls I only encounter -1 returns and NULL returns for error reporting. So I'd like int tty = check(open(check(ctermid(0)), O_RDRW); to work. I guess this could be done by providing two overloads for the 'Wrong' function...., but not, the 'Enforcer' template only works for specific type of return value :-( - Volodya