2次元配列の関数渡し。 [C++]
disp が正統な書き方?
disp2では
assignment from incompatible pointer type
が取れないけれど、とりあえず、動いた。
配列のキャストはエラーになるので、ギブアップ。
disp3はエラーは出ないが、別ファイルにするときにプロトタイプの書き方が?
void disp3(int dt[*][*], int n,int m);
では次のwarningとエラーが出る
warning: GCC does not yet properly implement `[*]' array declarators
error: parse error before "int"
で、配列の要素数を先にしてOK。(disp4)
disp2では
assignment from incompatible pointer type
が取れないけれど、とりあえず、動いた。
配列のキャストはエラーになるので、ギブアップ。
disp3はエラーは出ないが、別ファイルにするときにプロトタイプの書き方が?
void disp3(int dt[*][*], int n,int m);
では次のwarningとエラーが出る
warning: GCC does not yet properly implement `[*]' array declarators
error: parse error before "int"
で、配列の要素数を先にしてOK。(disp4)
2009-01-21 01:17
nice!(0)
テンプレート・インスタンスの存在箇所 [C++]
http://www.asahi-net.or.jp/~wg5k-ickw/html/online/gcc-2.95.2/gcc_5.html#SEC110
オブジェクト重複でファイルの肥大化しそうだが、.h に実装を書くことで、コンパイラオプション、pragma やテンプレート・インスタンスファイルの使用を避けた。
オブジェクト重複でファイルの肥大化しそうだが、.h に実装を書くことで、コンパイラオプション、pragma やテンプレート・インスタンスファイルの使用を避けた。
2009-01-18 15:13
nice!(0)
式はノードセットに対して評価する必要があります。 [C++]
ハンドルされていない例外: System.Xml.XPath.XPathException: 式はノードセットに対して評価する必要があります。
Expression must evaluate to a node-set
Expression must evaluate to a node-set
2009-01-04 07:24
nice!(0)
G++ ReadOnly Property [C++]
参照したWebはもう見つけられないので、メモをのこす。
=== ReadOnly.h ===
=== ReadOnly.cpp ===
=== test_ReadOnly.cpp ===
=== ReadOnly.h ===
#ifndef __READONLY_H__
#define __READONLY_H__
class ReadOnly {
public:
ReadOnly();
~ReadOnly() throw();
const int &Readonly_int;
const char * const Readonly_char_p;
void set_int(int n);
void set_char(char* p);
private:
int rw_int;
char rw_char_p[1000];
};
#endif
=== ReadOnly.cpp ===
#include
#include
#include
#include "ReadOnly.h"
ReadOnly::ReadOnly():Readonly_int(rw_int),Readonly_char_p(rw_char_p) {}
ReadOnly::~ReadOnly() throw(){}
void ReadOnly::set_int(int n){
rw_int = n;
}
void ReadOnly::set_char(char* p){
strcpy(rw_char_p,p);
}
=== test_ReadOnly.cpp ===
#include
#include
#include "ReadOnly.h"
char w[] ="World";
int main(int argc,char ** argv){
ReadOnly ro;
ro.set_int(999);
ro.set_char("Hello");
printf("int:%d char:%s\n",ro.Readonly_int,ro.Readonly_char_p);
// the following three can't be compiled
// ro.Readonly_int = 100; // assignment of read-only location
// ro.Readonly_char_p[0] = '\0'; // assignment of read-only location
// ro.Readonly_char_p = w; // assignment of read-only data-member `ReadOnly::Readonly_char_p'
return EXIT_SUCCESS;
}
2008-12-18 17:23
nice!(0)
VC2008/WSDK2008/SP1 インストールの順番 [C++]
があるらしい。
プログラムを作ろう! Microsoft Visual C++ 2008 Express Edition 入門 (マイクロソフト公式解説書)
- 作者: WINGSプロジェクト
- 出版社/メーカー: 日経BPソフトプレス
- 発売日: 2008/03
- メディア: 単行本
2008-10-03 18:10
nice!(0)