diff options
| -rw-r--r-- | man3/dlopen.3 | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/man3/dlopen.3 b/man3/dlopen.3 index 55b6871a35..e94cbd0c21 100644 --- a/man3/dlopen.3 +++ b/man3/dlopen.3 @@ -468,20 +468,23 @@ main(int argc, char **argv) cosine = (double (*)(double)) dlsym(handle, "cos"); - /* According to the C99 standard, casting 'void *' to a function pointer - as shown above is forbidden. POSIX.1-2003 and POSIX.2008 followed - C99's requirement, and proposed the following workaround: + /* According to the ISO C standard, casting between function + pointers and 'void *' produces undefined results. + POSIX.1-2003 and POSIX.1-2008 accepted this state of affairs + and proposed the following workaround: *(void **) (&cosine) = dlsym(handle, "cos"); - This (clumsy) cast conforms with C99 and will avoid any compiler - warnings. + This (clumsy) cast conforms with ISO C standard and will avoid + any compiler warnings. - 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. */ + 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. */ +.\" 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 error = dlerror(); if (error != NULL) { |
