From: Rich Felker <dalias@libc.org>
To: musl@lists.openwall.com
Subject: Further limits/stdint issues
Date: Tue, 2 Dec 2014 20:02:04 -0500 [thread overview]
Message-ID: <20141203010204.GA5440@brightrain.aerifal.cx> (raw)
Based on Jens' proposed patches, I took another look at things in
limits.h and stdint.h and here are some things I noticed that should
perhaps be changed:
LLONG_MAX is needlessly in bits/limits.h despite widespread
assumptions that long long is 64-bit.
LONG_BIT and LONG_MAX in bits/limits.h are redundant; either can be
derived from the other.
In general I try to avoid #ifdefs for feature tests in bits headers,
so perhaps we could make bits/limits.h just define __PAGE_SIZE and
__LONG_BIT and leave it to the top-level limits.h to expose these as
PAGE_SIZE and LONG_BIT according to feature tests and to derive
LONG_MAX from __LONG_BIT.
UINT32_MAX and UINT64_MAX lack the U suffix. This probably does not
matter for UINT64_MAX since the value does not fit in intmax_t, but
for UINT32_MAX, it will be treated as a signed value at the
preprocessor level without the U suffix.
The fast16/fast32 types and limits are still in bits/stdint.h despite
not varying between archs. Removing those would make bits/stdint.h
tiny/trivial. Aside from PAGE_SIZE, both bits/limits.h and
bits/stdint.h would essentially have no information except
"long/pointer size" and maybe we could even eventually eliminate them
by having a global idea of "wordsize".
As noted in the other thread, wint_t should be a shared type, not
arch-specific, and WINT_MIN needs to be unsigned.
WCHAR_MIN could be defined slightly simpler (just L'\0') in the
unsigned case.
It may be possible to eliminate the #if UINTPTR_MAX == UINT64_MAX
check for defining INT64_C() etc. using an expression that yields the
right type naturally (e.g. (c)+0*0x7fffffffffffffff etc.) but I'm not
sure if that's an improvement.
Rich
next reply other threads:[~2014-12-03 1:02 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-03 1:02 Rich Felker [this message]
2014-12-03 4:10 ` Glenn Weinberg
2014-12-03 5:03 ` Rich Felker
2014-12-03 16:34 ` Glenn Weinberg
2014-12-03 17:01 ` Rich Felker
2014-12-03 21:08 ` Glenn Weinberg
2014-12-03 10:38 ` 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=20141203010204.GA5440@brightrain.aerifal.cx \
--to=dalias@libc.org \
--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).