diff options
| author | Michael Kerrisk <mtk.manpages@gmail.com> | 2014-01-02 22:34:20 +1300 |
|---|---|---|
| committer | Michael Kerrisk <mtk.manpages@gmail.com> | 2014-01-02 22:34:20 +1300 |
| commit | daf28a2b22b94b80455ad3c82fdcf884bf81cb14 (patch) | |
| tree | 59f25d4e9c3faa23753c4a2a8e3455c0a9bf00d7 /man3/dlopen.3 | |
| parent | 65d28e98708d773e5165bdfd4ea417bf137e33f4 (diff) | |
| download | man-pages-daf28a2b22b94b80455ad3c82fdcf884bf81cb14.tar.gz | |
dlopen.3: Tweaks to previous patch
Reported-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
Diffstat (limited to 'man3/dlopen.3')
| -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) { |
