<br><br><div class="gmail_quote">On Tue, Feb 10, 2009 at 3:07 PM, Chris Lattner <span dir="ltr"><<a href="mailto:clattner@apple.com">clattner@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div style="word-wrap:break-word"><div class="Ih2E3d"><div><div>On Feb 10, 2009, at 2:57 PM, Douglas Gregor wrote:</div><blockquote type="cite"><div style="word-wrap:break-word"><div><blockquote type="cite"><div class="gmail_quote">
<div><span style="font-family:Helvetica;font-size:12px"><div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;color:rgb(117, 73, 45)">(CFURLRef)(nsObject), \</div> <div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;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;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 color="#75492D" face="Monaco" size="2"><span style="font-size:10px"><br>
</span></font></div><div><font face="arial" size="3"><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><div>right, it is easy to turn that into a macro.  :)  It is also a lot better in the error case than "<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 color="#75492D" face="Monaco" size="2"><span style="font-size:10px"><br></span></font></div><font color="#888888"><div><font color="#75492D" face="Monaco" size="2"><span style="font-size:10px">-Chris</span></font></div>
</font></div></blockquote></div><br><div>Cool. :-)  Yes, it might be possible to do better than that for the error anyway, that's just as far as I got.  I don't actually care if this is a macro either.  The functions Doug suggested would be fine.  Sounds nice.</div>
<div><br></div><div>-Ken</div><div><br></div>