符号変換コードがおかしい

| コメント(0) | トラックバック(0)

http://fne.cocolog-nifty.com/blog/2009/10/post-7c67.html

で書いたコード、確かにコマンドラインコンパイルでは問題なく動いたのに、プロジェクトに組み込んだら、#defineの中身を解釈してくれないばかりか、コンパイルエラー出まくる。

仕方ないので、ベタ書きした。

// 符号変換to_signed, to_unsigned
unsigned char    to_unsigned(const char& x)             { return (unsigned char) x; }
unsigned char    to_unsigned(const unsigned char& x)    { return x; }
unsigned short   to_unsigned(const short& x)            { return (unsigned short) x; }
unsigned short   to_unsigned(const unsigned short& x)   { return x; }
unsigned int     to_unsigned(const int& x)              { return (unsigned int) x; }
unsigned int     to_unsigned(const unsigned int& x)     { return x; }
unsigned __int64 to_unsigned(const __int64& x)          { return (unsigned __int64) x; }
unsigned __int64 to_unsigned(const unsigned __int64& x) { return x; }

char             to_signed(const char& x)               { return x; }
char             to_signed(const unsigned char& x)      { return (char) x; }
short            to_signed(const short& x)              { return x; }
short            to_signed(const unsigned short& x)     { return (short) x; }
int              to_signed(const int& x)                { return x; }
int              to_signed(const unsigned int& x)       { return (int) x; }
__int64          to_signed(const __int64& x)            { return x; }
__int64          to_signed(const unsigned __int64& x)   { return (__int64) x; }

なんだかなぁ

トラックバック(0)

トラックバックURL: http://blog.fne.jp/mt/mt-tb.cgi/31

コメントしちゃいなよ

    

サイトカウンタ

Total: 211,632 Hits, (Recent24Hours: 0 Hits)
~ Since 2010/01 ~

埋め込みツイッター

取得失敗;;
Now: 2024/04/20 10:01:28 JST

このブログ記事について

このページは、ふぅみんが2009年11月28日 02:22に書いたブログ記事です。

ひとつ前のブログ記事は「まずは32bitだったら動作OK」です。

次のブログ記事は「MSDNプロダクトキー変換表示用XSLT/XML 更新」です。

最近のコンテンツはインデックスページで見られます。過去に書かれたものはアーカイブのページで見られます。

月別 アーカイブ

2024年2月

 日   月   火   水   木   金   土 
        1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29    

埋め込みQRコード