[adlint-user-ja:101] Re: オブジェクト変換について
Open source and free source code static analyzer
Brought to you by:
asamiogis
From: 井上 妥 T. D. <Ino...@te...> - 2016-04-14 23:41:58
|
高瀬様 いつもおせわになります。井上です。 あれから別業務を行っていたため、解析作業が停滞しています。 ご指摘いただき、ありがとうございます。 近日中に再開する予定ですので、対応してみます。 文献についても当たってみますが、高価なものですね。 大きい図書館へ行っても見る予定です。 ありがとうございました。 ________________________________________ 差出人: Ryuichi Takase [r-t...@ai...] 送信日時: 2016年4月8日 8:47 宛先: adl...@li... 件名: [adlint-user-ja:100] Re: オブジェクト変換について 高瀬です。 どなたからも回答がないようなので、少しだけ。 次のコードように、違う型の変数へ代入されているのではないでしょうか。 int main(int argc, char **argv) { typedef enum { two, three, four, five, six, seven, eight, nine, ten, Jack, Queen, King, Ace } rank; rank card = Ace; int number = card; return 0; } 明示的にint型にキャストすれば、指摘が消えると思います。 しかし、そもそも列挙型はint型ではありません。 この辺りの概念については、下記の文献によくまとまっていると思います。 C.A.R.ホーア. "II データ構造化序論". 構造化プログラミング. サイエンス社, 1975, p.97-196. On Sat, 26 Mar 2016 05:11:08 +0000 井上 妥 TechnoPro Design <Ino...@te...> wrote: > いつもお世話になります。v3.2.14を利用しております。 > 今回開発・改修したソースをadlintに通してみました。 > すると、以下のような指摘がありました。 > > W9003:暗黙的に `enum __adlint__anon_20' 型のオブジェクトが `int' 型のオブジェクトに変換されています。 > > いろいろと調べてみたのですが、よくわかりません。 > よく他の指摘箇所も見てみると、typedefでenumやらunionのメンバを使用している > 部分に、上記の指摘があるように見えます。 > この「__adlint_anon_20」とやらについて、ご存じでしたら教えてください。 > ------------------------------------------------------------------------- 高瀬竜一 <r-t...@ai...> 国立研究開発法人 産業技術総合研究所 情報・人間工学領域 知能システム研究部門 マニピュレーション研究グループ ------------------------------------------------------------------------- ------------------------------------------------------------------------------ _______________________________________________ adlint-user-ja mailing list adl...@li... https://lists.sourceforge.net/lists/listinfo/adlint-user-ja ________________________________ 受信されたメールにお心当たりのない場合は、送信者にご連絡を頂くとともに、本メールは破棄して頂くようお願い致します。 If you receive this message by mistake, please advise the sender immediately and delete this message from your system. |