cosine = (double (*)(double)) dlsym(handle, "cos");
- /* According to the ISO C standard, casting between function
- pointers and 'void *', as done above, produces undefined results.
- POSIX.1\-2003 and POSIX.1\-2008 accepted this state of affairs and
- proposed the following workaround:
+ /* ISO の C 標準によれば、上のような、関数ポインタと 'void *' 間の
+ キャストを行った場合に得られる結果は不定である。
+ POSIX.1\-2003 と POSIX.1\-2008 では、この状況は認められており、
+ 以下のようなワークアラウンドが提案されている。
*(void **) (&cosine) = dlsym(handle, "cos");
- This (clumsy) cast conforms with the ISO C standard and will
- avoid any compiler warnings.
+ この (ぶかっこうな) キャストは ISO の C 標準に従っており、
+ コンパイラの警告を避けることができる。
.\" http://pubs.opengroup.org/onlinepubs/009695399/functions/dlsym.html#tag_03_112_08
.\" http://pubs.opengroup.org/onlinepubs/9699919799/functions/dlsym.html#tag_16_96_07
.\" http://austingroupbugs.net/view.php?id=74
- The 2013 Technical Corrigendum to POSIX.1\-2008 (a.k.a.
- POSIX.1\-2013) improved matters by requiring that conforming
- implementations support casting 'void *' to a function pointer.
- Nevertheless, some compilers (e.g., gcc with the '\-pedantic'
- option) may complain about the cast used in this program. */
+ POSIX.1\-2008 の 2013 Technical Corrigendum (別名 POSIX.1\-2013)
+ では、 POSIX に準拠する実装では 'void *' から関数ポインタへの
+ キャストをサポートすることが要求されるようになり、状況が改善
+ された。にもかかわらず、('\-pedantic' オプションを指定した gcc
+ などの) いくつかのコンパイラは、このプログラムで使用されている
+ キャストについて文句を言うのだ。
error = dlerror();
if (error != NULL) {