Sorry for delay, I misplaced this and just re-found it.
On Sat, 1 Jun 2024 18:19:32 +0000,
zbigniew2011@gmail.com (LIT) wrote:
...
ANSI-C: printf("%d\n", -3 / 10) gives output 0
"ANSI C" is ambiguous. When the first C standard was created in 1989
by ASC X3 J11 people called it ANSI. That standard was then adopted
with only editorial changes by "ISO" (technically, ISO/IEC JTC1 SC22).
Since then several revised standards have been _jointly_ developed by
the ANSI subcommittee (now mutated into INCITS) and the ISO one, and
published by ANSI, ISO, and other national members.
Some people reserve the name "ANSI C" only for C89/90, while some
apply it to the newer versions in which ANSI participates but no
longer controls. This matters here because C89/90 made rounding of
division with a negative operand implementation-dependent (and
required % for remainder to be consistent with division always so with
a negative operand it was also implementation-dependent). C99 and
later -- which per above might or might not be called "ANSI C" --
standardized division rounding as toward-zero (and % consistent).
Current C implementations follow the newer standards, unless you
resurrect an ancient one, like Borland Turbo C on an emulated (i.e.
fake) PC/AT with MSDOS 2 or something like that.
--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)