mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Szabolcs Nagy <nsz@port70.net>
To: musl@lists.openwall.com
Subject: Re: [PATCH] String: expand to word size && refactor || refactor
Date: Sun, 7 Apr 2013 17:21:31 +0200	[thread overview]
Message-ID: <20130407152131.GS30576@port70.net> (raw)
In-Reply-To: <1365345097.26995.30.camel@eris.loria.fr>

* Jens Gustedt <jens.gustedt@inria.fr> [2013-04-07 16:31:37 +0200]:
> > 
> > the unsigned -1 idiom is used a lot in musl anyway
> 
> hm, for macros I really would be more cautious. Couldn't one day such
> a macro end up in a #if directive? Then using the named macro would be
> better since this then gives the same value for the
> preprocessor.

yes this is clearly not preprocessor safe but that was not the goal

it's annoying that the preprocessor handles numbers as [u]intmax_t,
otherwise no bits/stdint.h or bits/limits.h were needed, you could
define all the limits in terms of -1U, -1UL, -1ULL

one could say that cpp is simpler this way but it still has to know
a lot of things eg wide characters should work: musl uses
#if L'0'-1 > 0 to determine if wchar_t is unsigned

> > the really clear definition would be (size_t)0x0101..01 but it
> > depends on the word size
> 
> that should be (size_t)+0x0101..01 such that it can be evaluated in
> the preprocessor.

nice trick..


      reply	other threads:[~2013-04-07 15:21 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-06 20:38 Nathan McSween
2013-04-06 20:38 ` Nathan McSween
2013-04-07  9:23   ` Szabolcs Nagy
2013-04-07  9:38     ` Jens Gustedt
2013-04-07 13:29       ` Szabolcs Nagy
2013-04-07 14:31         ` Jens Gustedt
2013-04-07 15:21           ` Szabolcs Nagy [this message]

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=20130407152131.GS30576@port70.net \
    --to=nsz@port70.net \
    --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).