Sujet : Re: What is your opinion about unsigned int u = -2 ?
De : ben (at) *nospam* bsb.me.uk (Ben Bacarisse)
Groupes : comp.lang.cDate : 01. Aug 2024, 12:02:24
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <87bk2cecan.fsf@bsb.me.uk>
References : 1 2
User-Agent : Gnus/5.13 (Gnus v5.13)
Blue-Maned_Hawk <
bluemanedhawk@invalid.invalid> writes:
Thiago Adams wrote:
...
How about this one?
unsigned int u2 = -2;
Does it makes sense? Maybe a warning here?
>
I cannot think of any situations where that would make sense, but i also
cannot guarantee that there are not any.
Some of the multi-byte conversion functions (like mbrtowc) return either
(size_t)-1 or (size_t)-2 to indicate different kinds of failure so it's
not inconceivable that someone might write
size_t processed_but_incomplete = -2;
-- Ben.