Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Fri, 25 Jul 2014 23:59:06 +0200
From: Jens Gustedt <jens.gustedt@...ia.fr>
To: musl@...ts.openwall.com
Subject: Re: C11 threads

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 ::





Download attachment "signature.asc" of type "application/pgp-signature" (199 bytes)

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.