<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div>On Feb 10, 2009, at 2:57 PM, Douglas Gregor wrote:</div><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><blockquote type="cite"><div class="gmail_quote"><div><span class="Apple-style-span" style="font-family: Helvetica; font-size: 12px; "><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; color: rgb(117, 73, 45); ">(CFURLRef)(nsObject), \</div> <div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; color: rgb(117, 73, 45); ">__builtin_choose_expr (__builtin_types_compatible_p (typeof (nsObject), NSOutputStream*), (CFWriteStreamRef)(nsObject), \</div> <div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; color: rgb(20, 135, 11); "><span style="color: rgb(50, 0, 214); ">1.0</span>/*error on type not found*/<span style="color: rgb(117, 73, 45); "> )))))))))))))))))))))))))</span></div> <div><font class="Apple-style-span" color="#75492D" face="Monaco" size="2"><span class="Apple-style-span" style="font-size: 10px;"><br></span></font></div><div><font class="Apple-style-span" face="arial" size="3"><span class="Apple-style-span" style="font-size: 13px;">Would the changes you're talking about make this less disgusting?</span></font></div></span></div></div></blockquote><br></div><div><br></div><div>I believe so. The idea would be to create a bunch of overloaded functions like so:</div><div><br></div><div>  inline CFArrayRef NSToCF(NSArray *nsObject) __attribute__((always_inline, overloaded)) { return (CFArrayRef)nsObject; }</div><div><div>  inline CFAttributedStringRef NSToCF(NSAttributedString *nsObject) __attribute__((always_inline, overloaded)) { return (CFAttributedStringRef)nsObject; }</div><div><div>  inline CFCalendarRef NSToCF(NSCalendar *nsObject) __attribute__((always_inline, overloaded)) { return (CFCalendarRef)nsObject; }</div><div><div>  inline CFDataRef NSToCF(NSData *nsObject) __attribute__((always_inline, overloaded)) { return (CFDataRef)nsObject; }</div><div>  // and so on</div><div><br></div><div>It's better than counting parentheses :)</div></div></div></div></div></blockquote><br></div><div>right, it is easy to turn that into a macro.  :)  It is also a lot better in the error case than "<span class="Apple-style-span" style="color: rgb(20, 135, 11); font-family: Monaco; font-size: 10px; "><span style="color: rgb(50, 0, 214); ">1.0</span>/*error on type not found*/<span style="color: rgb(117, 73, 45); "> " :)</span></span></div><div><font class="Apple-style-span" color="#75492D" face="Monaco" size="2"><span class="Apple-style-span" style="font-size: 10px;"><br></span></font></div><div><font class="Apple-style-span" color="#75492D" face="Monaco" size="2"><span class="Apple-style-span" style="font-size: 10px;">-Chris</span></font></div></body></html>