Path: csiph.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail
From: Tim Rentsch
Newsgroups: comp.lang.c
Subject: Re: why is there not a ipow version of pow?
Date: Sun, 23 Aug 2026 09:14:10 -0700
Organization: A noiseless patient Spider
Lines: 35
Message-ID: <86v790yfu5.fsf@linuxsc.com>
References: <115eks4$3pn1s$1@dont-email.me> <115f20j$3un9e$1@dont-email.me> <115f64m$ml3$1@raubtier-asyl.eternal-september.org> <115f7h5$1659$2@dont-email.me> <115f7v8$1b5d$1@raubtier-asyl.eternal-september.org> <115facm$1659$3@dont-email.me> <115fchf$2e17$1@dont-email.me> <86y0e62kzd.fsf@linuxsc.com> <115sk02$189sr$4@dont-email.me> <115sm9t$9dju$1@dont-email.me> <115sosc$183lr$7@dont-email.me> <115t35d$e5dr$1@dont-email.me> <115toan$189sr$5@dont-email.me> <115ubgj$pd0i$2@dont-email.me> <11606me$1dl4b$1@kst.eternal-september.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Date: Sun, 23 Aug 2026 16:14:11 +0000 (UTC)
Injection-Info: dont-email.me; logging-data="2117014"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+cBt75mmgI+34e49am345P4SCj+ybcnJY="; posting-host="f66050aa85370b7b068c3e444f0a8412"
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:PCVhhZHe4Zo2JUsCawTQtwP6Fx8= sha1:vHfyi2YvL/wysE9oLA2VQT6S+b8= sha256:yQ+9V4XHf/iZQvt0Me7almPS2WJXBRsF47i/8HQmivA= sha1:b6Hrmw/6cF+tKTUoNaDV8dy5uk0= sha256:pq4SGB3MJj6JqN445cyxPBO+yT6o/W8XKArTNHdKek8=
Xref: csiph.com comp.lang.c:401442
Keith Thompson writes:
> scott@slp53.sl.home (Scott Lurndal) writes:
>
>> David Brown writes:
>
> [...]
>
>>> Some people see that as an advantage - being able to write "unsigned
>>> very_big = -1;". I dislike it personally, but styles and preferences
>>> vary, and it has portability advantages over, say, 0xffff'ffff.
>>
>> I also dislike that use of -1. I prefer using ~0ul to get all-ones.
>
> I'd use ~0ul to get all-ones, -1 or -1u to get the largest value
> of the type (or preferably UINT_MAX, but -1 is good if it's not
> obvious *which* unsigned type I'm using).
The idea that all ones and the largest value should be treated
differently seems rather odd. Surely it is immediately obvious
that the largest value (of any unsigned type) will have all bits
set to one; using -1 will always provide both.
> The fact that they happen to be the same value is a technical detail
> that I don't necessarily want to worry about. Whether I use ~0ul
> or -1 depends on which concept I want to express.
This idea seems even odder. Presumably the point of expressing a
concept is to convey it to the reader. I think very few readers
would understand what distinction is intended by the different
writings here. A simpler and more reliable way is just to use a
comment
size_t k = -1; // largest value
size_t mask = -1; // all ones