納涼! プログラミング怪談大会!
![](https://s.togetter.com/static/web/img/placeholder.gif)
ネタ的に最初のほうに投稿したい、あるいは最後の方に投稿したいって方はいらっしゃいますか~? #proghost [PG怪談大会 http://bit.ly/aJnZH6 開催中]
2010-07-03 23:09:40![](https://s.togetter.com/static/web/img/placeholder.gif)
ネタの投稿は各自空気見ながら適当に行って行ってください。 #proghost [PG怪談大会 http://bit.ly/aJnZH6 開催中]
2010-07-03 23:14:33![](https://s.togetter.com/static/web/img/placeholder.gif)
ちなみにハッシュタグの由来は PROgraming GHOst STory -> #proghost です。 [PG怪談大会 http://bit.ly/aJnZH6 開催中]
2010-07-03 23:15:21![](https://s.togetter.com/static/web/img/placeholder.gif)
それではプログラミング怪談のネタを投稿していきましょう! ハッシュタグ #proghost をつけて投稿することをお忘れ無く! [PG怪談大会 http://bit.ly/aJnZH6 開催中]
2010-07-03 23:16:14開催中
![](https://s.togetter.com/static/web/img/placeholder.gif)
switch(2) { case 1,2,3: puts("1 or 2 or 3"); default: puts("others"); } このコードを Borland C++ でコンパイルおよび実行するとその出力結果は "others" となります。 #proghost
2010-07-03 23:23:23![](https://s.togetter.com/static/web/img/placeholder.gif)
すごく不思議な感じがする・・・ RT @uskz: PHPは条件演算子が左結合 http://ideone.com/0zFAh #proghost
2010-07-03 23:24:07![](https://s.togetter.com/static/web/img/placeholder.gif)
あ、break; が抜けてた。ちなみに switch(3) だと "1 or 2 or 3" が出力されます。これはどういう事かと言うと case 1, 2, 3: がどうもカンマ演算子によって case 3: のように解決されてしまっているものと思われます。 #proghost
2010-07-03 23:31:39![](https://s.togetter.com/static/web/img/placeholder.gif)
@haxe Borland C++ だと警告もエラーもなく通っちゃうんですよ、これ。 #proghost [PG怪談大会 http://bit.ly/aJnZH6 開催中]
2010-07-03 23:32:40![](https://s.togetter.com/static/web/img/placeholder.gif)
一番最初のコメントを外すとコンパイルエラーがなくなる(ScalaだけじゃなくてJavaとかC#でも) http://ideone.com/5bsUA #proghost
2010-07-03 23:38:00![](https://s.togetter.com/static/web/img/placeholder.gif)
・・・!? RT @bleis: 一番最初のコメントを外すとコンパイルエラーがなくなる(ScalaだけじゃなくてJavaとかC#でも) http://ideone.com/5bsUA #proghost
2010-07-03 23:39:50![](https://s.togetter.com/static/web/img/placeholder.gif)
ひとつ思い出した某開発環境の話。void func(int a, int b = 0); という関数を func(1 2); と呼び出しても問題なくコンパイルが通ることがあった。この場合の b はデフォルト引数で実行されてた。 #proghost
2010-07-03 23:40:57![](https://s.togetter.com/static/web/img/placeholder.gif)
予期せぬUnicode Escapeに注意してくださいね、という話です。\uから始まるものはUnicode Escapeとみなされるので、次に4桁ほど数字が来ないとコンパイルエラーになっちゃいます #proghost
2010-07-03 23:42:40![](https://s.togetter.com/static/web/img/placeholder.gif)
JavaScript界隈はこんなのもあって怖いですよねぇ。 http://cpplover.blogspot.com/2010/02/javascript_17.html #proghost [PG怪談大会 http://bit.ly/aJnZH6 開催中]
2010-07-03 23:58:13![](https://s.togetter.com/static/web/img/placeholder.gif)
JSこえー RT @uskz: オブジェクトはtrueに変換されるのである http://ideone.com/KQN9J #proghost
2010-07-04 00:03:31![](https://s.togetter.com/static/web/img/placeholder.gif)
#proghost LUA 文字リテラルでも数字っぽかったら数値として扱うとか何それこわい http://ideone.com/3LFKO
2010-07-04 00:05:44