揮発性のメモ2

http://d.hatena.ne.jp/iww/

warning: multi-line comment

シフトJISのソースをコンパイルするとき、コメントの行末が「能」だったりすると出る。

  • gccのワーニング
usart.h:18:1: warning: multi-line comment
  • 問題のソース
17: // ==========================
18: // 変更可能
19: // ==========================
  • 原因

SJISの「能」は 0x94,0x5C であるため。
0x5C は ASCIIでは \ になるので、次の行とくっつく

  • 対策

gccのオプションに --input-charset=cp932 をつける

http://www.google.co.jp/search?q=cache:http://twistbendcoupling.net/2006/04/blog-post_16.html
http://ja.wikipedia.org/wiki/%EF%BF%A5%E8%A8%98%E5%8F%B7

WinAVRのCygwin環境では --input-charset=cp932 をつけると iconvが無い とか言ってエラーになる