Re: [問題] Wrapping/Widening + Var-args

看板java作者 (LetMeGoogleThatForYou)時間15年前 (2010/09/09 11:50), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串5/5 (看更多)
※ 引述《tkcn (小安)》之銘言: : 而因為這個 bug 的 priority 是 Vary Low, : 所以拖了近六年至今還沒被處理掉....XD http://download.oracle.com/javase/1.5.0/docs/guide/language/varargs.html So when should you use varargs? As a client, you should take advantage of them whenever the API offers them. Important uses in core APIs include reflection, message formatting, and the new printf facility. As an API designer, you should use them sparingly, only when the benefit is truly compelling. Generally speaking, you should not overload a varargs method, or it will be difficult for programmers to figure out which overloading gets called. Translation 1: Just because you can, it doesn't necessarily mean you should. Translation 2: Don't f* do it. XD If anyone's interested in this sort of (fun) stuff, read Eric Lippert's blog. It's full of this kind of (fun) stuff. ;) http://blogs.msdn.com/b/ericlippert/ -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 65.87.177.87
文章代碼(AID): #1CY5boRG (java)
討論串 (同標題文章)
文章代碼(AID): #1CY5boRG (java)