about summary refs log tree commit diff
path: root/include/search.h
diff options
context:
space:
mode:
authorSzabolcs Nagy <nsz@port70.net>2012-12-19 04:05:30 +0100
committerSzabolcs Nagy <nsz@port70.net>2012-12-19 04:05:30 +0100
commite9e2b66e687bc0b4d07305a2b288ed8ff4ae5b4b (patch)
treec4fce41ccde790f927862ddd0092d1762ab0ff66 /include/search.h
parentc6383b7b10303457306932584fc23f24b5153a81 (diff)
downloadmusl-e9e2b66e687bc0b4d07305a2b288ed8ff4ae5b4b.tar.gz
musl-e9e2b66e687bc0b4d07305a2b288ed8ff4ae5b4b.tar.xz
musl-e9e2b66e687bc0b4d07305a2b288ed8ff4ae5b4b.zip
math: new type cast logic in tgmath.h
* return type logic is simplified a bit and fixed (see below)
* return type of conj and cproj were wrong on int arguments
* added comments about the pending issues
(usually we don't have comments in public headers but this is
not the biggest issue with tgmath.h)

casting the result to the right type cannot be done in c99
(c11 _Generic can solve this but that is not widely supported),
so the typeof extension of gcc is used and that the ?: operator
has special semantics when one of the operands is a null
pointer constant

the standard is very strict about the definition of null
pointer constants so typeof with ?: is still not enough so
compiler specific workaround is used for now

on gcc '!1.0' is a null pointer constant so we can use the old
__IS_FP logic (eventhough it's non-standard)

on clang (and on gcc as well) 'sizeof(void)-1' is a null
pointer constant so we can use
 !(sizeof(*(0?(int*)0:(void*)__IS_FP(x)))-1)
(this is non-standard as well), the old logic is used by
default and this new one on clang
Diffstat (limited to 'include/search.h')
0 files changed, 0 insertions, 0 deletions