Warning: mysqli::__construct(): (HY000/1203): User howardkn already has more than 'max_user_connections' active connections in D:\Inetpub\vhosts\howardknight.net\al.howardknight.net\includes\artfuncs.php on line 21
Failed to connect to MySQL: (1203) User howardkn already has more than 'max_user_connections' active connections
Warning: mysqli::query(): Couldn't fetch mysqli in D:\Inetpub\vhosts\howardknight.net\al.howardknight.net\index.php on line 66
Article <v5afob$j1nj$5@dont-email.me>
Deutsch   English   Français   Italiano  
<v5afob$j1nj$5@dont-email.me>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!feeds.phibee-telecom.net!news.mixmin.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Lawrence D'Oliveiro <ldo@nz.invalid>
Newsgroups: comp.lang.c
Subject: Re: The difference between strtol() and strtoul() ?
Date: Mon, 24 Jun 2024 00:48:12 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 23
Message-ID: <v5afob$j1nj$5@dont-email.me>
References: <v51d1l$2fklr$1@news.xmission.com>
	<v540t9$2gsdu$1@news.xmission.com> <20240621182839.00000dc4@yahoo.com>
	<20240621185314.00004fda@yahoo.com> <87o77uqktg.fsf@bsb.me.uk>
	<20240623121952.00005fa9@yahoo.com> <87r0cnq46s.fsf@bsb.me.uk>
	<20240623153219.000009b0@yahoo.com> <87jzifpth6.fsf@bsb.me.uk>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Mon, 24 Jun 2024 02:48:12 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="3048fea01d51f9337586ac8e02824e6c";
	logging-data="624371"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX18h9mAshMzzvMZ41+PHVLNp"
User-Agent: Pan/0.158 (Avdiivka; )
Cancel-Lock: sha1:HGXInMeumQBPKzRr0shlMLqoDE0=
Bytes: 2426

On Sun, 23 Jun 2024 16:30:13 +0100, Ben Bacarisse wrote:

> I think there /is/ something problematic with the wording about the
> negation.  It happens "in the return type" but how can
> 9223372036854775808 be negated in the type long long int?  OK, the
> negated value can be /represented/ in the type long long int but that's
> not quite the same thing.  On the othee hand, for the unsigned return
> types, the negation "in the return type" is what produces ULONG_MAX for
> "-1" when the negated value, -1, can't be /represented/ in the return
> type.  It's a case where, over the years, I've just got used to what's
> happening.

In the C23 spec, section 7.24.1.7, “The strtol, strtoll, strtoul, and 
strtoull functions”, paragraph 5 begins:

    If the subject sequence has the expected form and the value of
    base is zero, the sequence of characters starting with the first
    digit is interpreted as an integer constant according to the rules
    of 6.4.4.2.

Note this is excluding any sign. So if the non-negated value cannot be 
represented in the desired type, then there is no valid value to apply 
negation to, so according to paragraph 8, zero is returned.