鳳鳴は祖父の俳号

日記 メモ そんなの

GNU APL1.0 MacOSX10.8での作業メモ 6

 次はmain.cc。

clang: warning: argument unused during compilation: '-rdynamic'
main.cc:92:67: error: excess elements in struct initializer
static struct sigaction new_control_C_action = { control_C, 0, 0, 0, 0 };
^
main.cc:104:66: error: excess elements in struct initializer
static struct sigaction new_segfault_action = { seg_fault, 0, 0, 0, 0 };
^
main.cc:114:72: error: excess elements in struct initializer
static struct sigaction new_USR1_action = { signal_USR1_handler, 0, 0, 0, 0 };
^

 構造体初期化の時の要素数が多い。grepでsigactionを探す。

$ grep sigaction *.cc
main.cc:static struct sigaction old_control_C_action;
main.cc:static struct sigaction new_control_C_action = { control_C, 0, 0, 0, 0 };
main.cc:static struct sigaction old_segfault_action;
main.cc:static struct sigaction new_segfault_action = { seg_fault, 0, 0, 0, 0 };
main.cc:static struct sigaction old_USR1_action;
main.cc:static struct sigaction new_USR1_action = { signal_USR1_handler, 0, 0, 0, 0 };
main.cc: sigaction(SIGINT, &new_control_C_action, &old_control_C_action);
main.cc: sigaction(SIGUSR1, &new_USR1_action, &old_USR1_action);
main.cc:// sigaction(SIGSEGV, &new_segfault_action, &old_segfault_action);

{ control_C, 0, 0 }; の様に書き換えてクリアしたが、なぜ要素数が2個多いのか?
とりあえず次。NumericCell.cc。


NumericCell.cc:337:6: error: no matching member function for call to 'real'
a.real(round(a.real()));
~~^~~~
/usr/include/c++/4.2.1/complex:1198:20: note: candidate function not viable: requires 0 arguments, but 1 was provided
complex::real()
^
/usr/include/c++/4.2.1/complex:1202:20: note: candidate function not viable: requires 0 arguments, but 1 was provided
complex::real() const
^
NumericCell.cc:338:6: error: no matching member function for call to 'imag'
a.imag(round(a.imag()));
~~^~~~
/usr/include/c++/4.2.1/complex:1206:20: note: candidate function not viable: requires 0 arguments, but 1 was provided
complex::imag()
^
/usr/include/c++/4.2.1/complex:1210:20: note: candidate function not viable: requires 0 arguments, but 1 was provided
complex::imag() const
^
NumericCell.cc:339:6: error: no matching member function for call to 'real'
b.real(round(b.real()));
~~^~~~
/usr/include/c++/4.2.1/complex:1198:20: note: candidate function not viable: requires 0 arguments, but 1 was provided
complex::real()
^
/usr/include/c++/4.2.1/complex:1202:20: note: candidate function not viable: requires 0 arguments, but 1 was provided
complex::real() const
^
NumericCell.cc:340:6: error: no matching member function for call to 'imag'
b.imag(round(b.imag()));
~~^~~~
/usr/include/c++/4.2.1/complex:1206:20: note: candidate function not viable: requires 0 arguments, but 1 was provided
complex::imag()
^
/usr/include/c++/4.2.1/complex:1210:20: note: candidate function not viable: requires 0 arguments, but 1 was provided
complex::imag() const
^
NumericCell.cc:371:11: error: no matching member function for call to 'real'
z.real(- a.imag());
~~^~~~
/usr/include/c++/4.2.1/complex:1198:20: note: candidate function not viable: requires 0 arguments, but 1 was provided
complex::real()
^
/usr/include/c++/4.2.1/complex:1202:20: note: candidate function not viable: requires 0 arguments, but 1 was provided
complex::real() const
^
NumericCell.cc:372:11: error: no matching member function for call to 'imag'
z.imag( a.real());
~~^~~~
/usr/include/c++/4.2.1/complex:1206:20: note: candidate function not viable: requires 0 arguments, but 1 was provided
complex::imag()
^
/usr/include/c++/4.2.1/complex:1210:20: note: candidate function not viable: requires 0 arguments, but 1 was provided
complex::imag() const
^
NumericCell.cc:381:11: error: no matching member function for call to 'real'
z.real(- z.real());
~~^~~~
/usr/include/c++/4.2.1/complex:1198:20: note: candidate function not viable: requires 0 arguments, but 1 was provided
complex::real()
^
/usr/include/c++/4.2.1/complex:1202:20: note: candidate function not viable: requires 0 arguments, but 1 was provided
complex::real() const
^
NumericCell.cc:382:11: error: no matching member function for call to 'imag'
z.imag(- z.imag());
~~^~~~
/usr/include/c++/4.2.1/complex:1206:20: note: candidate function not viable: requires 0 arguments, but 1 was provided
complex::imag()
^
/usr/include/c++/4.2.1/complex:1210:20: note: candidate function not viable: requires 0 arguments, but 1 was provided
complex::imag() const
^
30 warnings and 8 errors generated.


NumericCell.ccのエラー行。

337 a.real(round(a.real()));
338 a.imag(round(a.imag()));
339 b.real(round(b.real()));
340 b.imag(round(b.imag()));

371 z.real(- a.imag());
372 z.imag( a.real());

381 z.real(- z.real());
382 z.imag(- z.imag());


/usr/include/c++/4.2.1/complex を見てみる。

1198 inline double&
1199 complex::real()
1200 { return __real__ _M_value; }

よくわからないが ナントカ.real() で値を返してくれそうなんだけど。
例えばz.real( -a.imag())は -a.imag()は正しくてz.real(引数)はいかんのかも。

実験として、分けて引数をなしにしてみた。
383 z.real(); - z.real();
384 z.imag(); - z.imag();

17 warnings generated.
mv -f .deps/apl-LvalCell.Tpo .deps/apl-LvalCell.Po
make[2]: *** [all-recursive] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2

が、よくわからないことに元の形に戻してもエラーが出なくなってしまった。

17 warnings generated.
mv -f .deps/apl-LvalCell.Tpo .deps/apl-LvalCell.Po
make[2]: *** [all-recursive] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2

エラーどこに消えた? つづく