public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Alejandro Colomar <colomar.6.4.3@gmail.com>
To: "Michael Kerrisk (man-pages)" <mtk.manpages@gmail.com>
Cc: linux-man@vger.kernel.org, gcc@gcc.gnu.org, libc-alpha@sourceware.org
Subject: Re: [PATCH v2 1/2] system_data_types.7: Add 'void *'
Date: Thu, 1 Oct 2020 18:55:04 +0200	[thread overview]
Message-ID: <41ab7ed9-3ce0-f8ad-38f4-c4bbeca138f8@gmail.com> (raw)
In-Reply-To: <d460f3a6-c12b-637d-b474-3596611d10d3@gmail.com>



On 2020-10-01 18:38, Michael Kerrisk (man-pages) wrote:
> Hi Alex,
> 
>> +According to the C language standard,
>> +a pointer to any object type may be converted to a pointer to
>> +.I void
>> +and back.
>> +POSIX further requires that any pointer,
>> +including pointers to functions,
>> +may be converted to a pointer to
>> +.I void
>> +and back.
> I know you are correct about POSIX, but which part of the
> standard did you find this information in? The only
> reference that I find in POSIX is the dlsym() spec. Is it
> covered also somewhere else in the standrd?
> 
> Thanks,
> 
> Michael
> 

Hi Michael,

I've bean searching, and dlsym is the only one:

________

user@debian:~/Desktop/src/Standards/susv4-2018$ grep -rn "pointer to a 
function"
functions/regfree.html:530:&quot;undefined&quot; means that the action 
by the application is an error, of similar severity to passing a bad 
pointer to a function.</p>
functions/dlsym.html:138:<p>Note that conversion from a <b>void *</b> 
pointer to a function pointer as in:</p>
functions/regcomp.html:530:&quot;undefined&quot; means that the action 
by the application is an error, of similar severity to passing a bad 
pointer to a function.</p>
functions/regexec.html:530:&quot;undefined&quot; means that the action 
by the application is an error, of similar severity to passing a bad 
pointer to a function.</p>
functions/V2_chap02.html:3039:<p>There are three types of action that 
can be associated with a signal: SIG_DFL, SIG_IGN, or a pointer to a 
function. Initially,
functions/regerror.html:530:&quot;undefined&quot; means that the action 
by the application is an error, of similar severity to passing a bad 
pointer to a function.</p>
user@debian:~/Desktop/src/Standards/susv4-2018$ grep -rn "function pointer"
basedefs/glob.h.html:165:"../functions/glob.html"><i>glob</i>()</a> 
prototype definition by removing the <b>restrict</b> qualifier from the 
function pointer
xrat/V4_xsh_chap02.html:114:when the application requires it; for 
example, if its address is to be stored in a function pointer variable.</p>
functions/dlsym.html:138:<p>Note that conversion from a <b>void *</b> 
pointer to a function pointer as in:</p>
user@debian:~/Desktop/src/Standards/susv4-2018$ grep -rn "pointer to 
function"
functions/dlsym.html:73:converted from type pointer to function to type 
pointer to <b>void</b>; otherwise, <i>dlsym</i>() shall return the 
address of the
user@debian:~/Desktop/src/Standards/susv4-2018$

 From those, the only one that documents this is functions/dlsym.
The rest is noise.

The most explicit paragraph in dlsym is the following:

[[
Note that conversion from a void * pointer to a function pointer as in:

fptr = (int (*)(int))dlsym(handle, "my_function");

is not defined by the ISO C standard.
This standard requires this conversion to work correctly
on conforming implementations.
]]

  reply	other threads:[~2020-10-01 16:55 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-01 15:06 [PATCH 0/2] Document void * Alejandro Colomar
2020-10-01 15:06 ` [PATCH 1/2] system_data_types.7: Add 'void *' Alejandro Colomar
2020-10-01 15:06 ` [PATCH 2/2] void-*.3: New link to system_data_types(7) Alejandro Colomar
2020-10-01 15:34 ` [PATCH 0/2] Document void * Michael Kerrisk (man-pages)
2020-10-01 15:40   ` Alejandro Colomar
2020-10-01 15:49     ` [PATCH v2 0/2] Document 'void *' Alejandro Colomar
2020-10-01 15:49     ` [PATCH v2 1/2] system_data_types.7: Add " Alejandro Colomar
2020-10-01 16:38       ` Michael Kerrisk (man-pages)
2020-10-01 16:55         ` Alejandro Colomar [this message]
2020-10-02 11:54           ` Michael Kerrisk (man-pages)
2020-10-08 13:52           ` Vincent Lefevre
2020-10-12  9:36             ` Michael Kerrisk (man-pages)
2020-10-01 17:32       ` Paul Eggert
2020-10-02  8:24         ` Alejandro Colomar
2020-10-02  8:48           ` Alejandro Colomar
2020-10-02 11:44             ` Michael Kerrisk (man-pages)
2020-10-02  9:10           ` David Laight
2020-10-02 17:00             ` Paul Eggert
2020-10-02 10:49           ` Jonathan Wakely
2020-10-02 11:31             ` Michael Kerrisk (man-pages)
2020-10-02 13:06               ` Jonathan Wakely
2020-10-02 13:20                 ` Alejandro Colomar
2020-10-02 13:27                   ` Jonathan Wakely
2020-10-02 13:51                     ` Alejandro Colomar
2020-10-03  8:00                       ` Navigational corrections (was: Re: [PATCH v2 1/2] system_data_types.7: Add 'void *') Michael Kerrisk (man-pages)
2020-10-03  9:16                         ` Navigational corrections Alejandro Colomar
2020-10-03 11:39                           ` Michael Kerrisk (man-pages)
2020-10-05 22:08                             ` Alejandro Colomar
2020-10-07  6:53                               ` Michael Kerrisk (man-pages)
2020-10-01 15:49     ` [PATCH v2 2/2] void.3: New link to system_data_types(7) Alejandro Colomar
2020-10-02 13:19     ` [PATCH 0/2] Document void * Jonathan Wakely
2020-10-03 11:44       ` Michael Kerrisk (man-pages)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=41ab7ed9-3ce0-f8ad-38f4-c4bbeca138f8@gmail.com \
    --to=colomar.6.4.3@gmail.com \
    --cc=gcc@gcc.gnu.org \
    --cc=libc-alpha@sourceware.org \
    --cc=linux-man@vger.kernel.org \
    --cc=mtk.manpages@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).