Liste des Groupes | Revenir à cl c |
On 02/08/2024 15:33, Kenny McCormack wrote:Also considerIn article <v8inds$2qpqh$1@dont-email.me>,C23 assumes 2s complement. However overflow on signed integers will still be considered UB: too many compilers depend on it.
Thiago Adams <thiago.adams@gmail.com> wrote:
...So it seams that anything is ok for unsigned but not for signed.>
Maybe because all computer gave same answer for unsigned but this is not
true for signed?
I think it is because it wants to (still) support representations other
than 2s complement. I think POSIX requires 2s complement, and I expect the
C standard to (eventually) follow suit.
>
But even if well-defined (eg. that UB was removed so that overflow just wraps as it does with unsigned), some here, whose initials may or may not be DB, consider such overflow Wrong and a bug in a program.
However they don't consider overflow of unsigned values wrong at all, simply because C allows that behaviour.
But I don't get it. If my calculation gives the wrong results because I've chosen a u32 type instead of u64, that's just as much a bug as using i32 instead of i64.
Les messages affichés proviennent d'usenet.