mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Jens Gustedt <jens.gustedt@inria.fr>
To: musl@lists.openwall.com
Subject: Re: C11 threads
Date: Fri, 25 Jul 2014 23:59:06 +0200	[thread overview]
Message-ID: <1406325546.6438.83.camel@eris.loria.fr> (raw)
In-Reply-To: <20140725161449.GD4038@brightrain.aerifal.cx>

[-- Attachment #1: Type: text/plain, Size: 2576 bytes --]

Am Freitag, den 25.07.2014, 12:14 -0400 schrieb Rich Felker:
> On Fri, Jul 25, 2014 at 03:04:39PM +0200, Szabolcs Nagy wrote:
> > http://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_078.html
> > 
> > without explanation the response says h can return 0.
> 
> Indeed there is no explanation. I don't think it could be related to
> macros because my understanding is that only function-like macros are
> allowed for the standard functions, i.e. you can override such macros
> by using ().

Indeed, I don't think that it has to do with macros per se, but with
the fact that one function can replace another one if the
implementation has the information that all requirements are
fulfilled. Indeed, if you have a version of memcpy that can cope with
overlapping memory blocks, you may also use it as memove.

> Both C99 and C11 contain in 7.1.4 paragraph 1 a footnote (161 or 185,
> respectively) reading:
> 
> "This means that an implementation shall provide an actual function
> for each library function, even if it also provides a macro for that
> function."
> 
> This suggests to me that there should be a one-to-one correspondence
> between actual functions and library functions, but maybe I'm reading
> too much into it.

I don't see where you get the one-to-one. For me this only says that
any library "function" can be used through the pointer-to-function.

I think the only intention is that any library function can be taken
as pointer, that pointer can be stored somewhere and then the
underlying function can be called from any context.

> > the musl math library currently defines distinct long double
> > functions even if long double and double have the same
> > representation, they could be weak aliases if the standard
> > allows this..
> 
> Indeed. If this issue is resolved to allow it, I think we should make
> this change and remove some otherwise-useless bloat.

If you are thinking in that direction, we definitively shouldn't use
trivial wrapper functions for the C11 functions. In all cases where
there is a trivial shift in the interface (such as the void return) I
would stay with the macro, and provide the additional symbol only for
the rare cases that someone asks for the address.

Jens

-- 
:: INRIA Nancy Grand Est ::: AlGorille ::: ICube/ICPS :::
:: ::::::::::::::: office Strasbourg : +33 368854536   ::
:: :::::::::::::::::::::: gsm France : +33 651400183   ::
:: ::::::::::::::: gsm international : +49 15737185122 ::
:: http://icube-icps.unistra.fr/index.php/Jens_Gustedt ::





[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

  reply	other threads:[~2014-07-25 21:59 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-25 10:00 Jens Gustedt
2014-07-25 10:40 ` Szabolcs Nagy
2014-07-25 11:06   ` Jens Gustedt
2014-07-25 13:04     ` Szabolcs Nagy
2014-07-25 13:38       ` Jens Gustedt
2014-07-25 13:42       ` Morten Welinder
2014-07-25 14:15         ` Szabolcs Nagy
2014-07-25 16:14       ` Rich Felker
2014-07-25 21:59         ` Jens Gustedt [this message]
2014-07-25 22:25           ` Rich Felker
2014-07-25 15:41     ` Rich Felker
2014-07-25 17:10       ` Jens Gustedt
2014-07-25 22:19         ` Rich Felker
2014-07-25 23:26           ` Jens Gustedt
2014-07-26  2:24             ` Rich Felker
2014-07-26  7:16               ` Jens Gustedt
2014-07-26  7:35                 ` Rich Felker
2014-07-26  8:32                   ` Jens Gustedt
2014-07-26  9:03                     ` Rich Felker
2014-07-26 11:15                       ` Jens Gustedt
2014-07-26 15:48                 ` Jens Gustedt

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=1406325546.6438.83.camel@eris.loria.fr \
    --to=jens.gustedt@inria.fr \
    --cc=musl@lists.openwall.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.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

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 NNTP newsgroup(s).