From: Rich Felker <dalias@aerifal.cx>
To: musl@lists.openwall.com
Subject: Re: inttypes.h: possible logical error?
Date: Wed, 13 Mar 2013 13:23:43 -0400 [thread overview]
Message-ID: <20130313172343.GF20323@brightrain.aerifal.cx> (raw)
In-Reply-To: <5140A8C4.1050207@eservices.virginia.edu>
On Wed, Mar 13, 2013 at 12:26:44PM -0400, Zvi Gilboa wrote:
> Greetings,
>
> In inttypes.h, the first "actual" lines read:
>
> ....
> #include <features.h>
> #include <stdint.h>
>
> #define __NEED_wchar_t
> #include <bits/alltypes.h>
> ....
>
> As it seems, the idea is to have <bits/alltypes.h> processed with
> __NEED_wchar_t already defined. However, <bits/alltypes.h> is also
> included by <stdint.h>.
>
> In a way this is rather harmless, specifically since
> <bits/alltypes.h> can be processed more than once, yet wouldn't it
> be more logical and/or consistent to #define __NEED_wchar_t prior
> to including <stdint.h>? Given no conflicting considerations, the
> above code snippet would then read:
>
> ....
> #define __NEED_wchar_t
>
> #include <features.h>
> #include <stdint.h>
> #include <bits/alltypes.h> /* possibly redundant? see stdint.h */
> ....
>
> Thanks in advance for any and all feedback!
I wouldn't call it an error. It's a suboptimality, but the tradeoff is
that one header (inttypes.h) is not making assumptions about the
implementation of the other. If others want to see this changed to
save an #include, we could consider it, but it would need to be
commented that the optimization depends on the implementation of
stdint.h.
Rich
next prev parent reply other threads:[~2013-03-13 17:23 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-13 16:26 Zvi Gilboa
2013-03-13 17:23 ` Rich Felker [this message]
2013-03-13 17:53 ` Zvi Gilboa
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=20130313172343.GF20323@brightrain.aerifal.cx \
--to=dalias@aerifal.cx \
--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).