2011-01-01から1年間の記事一覧

フレンド関数テンプレート

C++

#include "stdafx.h" class Hoge { public: // フレンド関数テンプレートの指定。 template <class T> friend void CallHogeEcho(Hoge&, T); private: void Echo(int x) { printf("Hoge: %d\n", x); } void Echo(const char* x) { printf("Hoge: %s\n", x); } }; temp</class>…

ライブラリの出力名を変える。

ライブラリの出力ファイル名を MyLibrary_x86_Debug.libていう感じにしたい。 更に、↓の感じのディレクトリ構成にしたい。 MyLibrary MyLibrary.sln MyLibrary MyLibrary.vcxproj lib MyLibrary_x86_Debug.lib MyLibrary_x64_Debug.lib MyLibrary_x86_Releas…

ファイバつかってみる。

関数の途中で戻って再開出来るとか、C言語コードだけ見てたらとても奇妙な冒険。 #include "stdafx.h" #include <Windows.h> const int LOOP_COUNT_IN_MAIN = 5; const int LOOP_COUNT_IN_FIBER = 5; PVOID pMainFiber; PVOID pFibers[4]; struct DestroyChecker { ~Des</windows.h>…

Excelを読む

C#

環境は、Visual C# 2010 Express の Microsoft Office (Excel) 2007。 Microsoft Excel Object Library を追加する。 ソリューションエクスプローラから、参照設定を右クリックし、参照の追加をクリックする。 COMタブを選択し、Microsoft Excel 12.0 Object…

クラステンプレートのメンバ関数、静的メンバ変数を外部で定義する。

C++

クラステンプレートのメンバ関数テンプレートを外部で定義する。 - erio_nk://memo でメンバ関数テンプレートの定義方法は記述してあったが、 ただのメンバ関数や静的メンバ変数の定義方法を記述していなかったので。 template <class T> struct Hoge { // 静的メンバ</class>…

Visual C++ 2010 Express で x64 環境を構築する。

Windows 7 Visual C++ 2010 Express x64 ビルド環境構築 - 日々のコーディングについてのページ こちらのサイトの丸写し状態だが…。 Visual C++ 2010 Express はインストールされているものとして、以下の手順を踏む。 Microsoft Windows SDK for Windows 7 …

32回以上左シフトするには、左辺を64bit整数型にする。

int _tmain(int argc, _TCHAR* argv[]) { int rhs32 = 63; __int64 rhs64 = 63; // NG { __int64 flags = 1 << rhs32; printf("%llx\n", flags); } // OK { __int64 flags = static_cast<__int64>(1) << rhs32; printf("%llx\n", flags); } // NG { __int64 flags = 1 </__int64>…

boolのアラインメント

#include <stdio.h> struct BoolAlign { bool _bool0; int _int0; bool _bool1; bool _bool2; int _int1; bool _bool3; bool _bool4; bool _bool5; int _int2; bool _bool6; bool _bool7; short _short0; bool _bool8; short _short1; bool _bool9; int _int3; }; int</stdio.h>…

コンストラクタを含む構造体は初期化子リストで初期化出来ない。

C++

struct DATA { int _hoge; int _fuga; int _piyo; DATA() : _hoge(0) , _fuga(0) , _piyo(0) {} }; int main() { // error C2552 DATA data[3] = { { 1, 1, 1 }, { 2, 2, 2 }, { 3, 3, 3 }, }; return 0; } Download Visual Studio 2005 Retired documentati…

VisualC++のmlに/omfを指定するとリンクは行われない。

アセンブラに興味がわいた為、昔買って本棚のこやしになっていた高級言語プログラマのためのアセンブラ入門作者: 林晴比古出版社/メーカー: ソフトバンク クリエイティブ発売日: 2005/11/30メディア: 単行本購入: 2人 クリック: 40回この商品を含むブログ (1…