Sujet : Re: C23 thoughts and opinions
De : ldo (at) *nospam* nz.invalid (Lawrence D'Oliveiro)
Groupes : comp.lang.cDate : 16. Jun 2024, 04:15:58
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <v4llde$3s87h$2@dont-email.me>
References : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
User-Agent : Pan/0.158 (Avdiivka; )
On Sat, 15 Jun 2024 20:42:47 -0500, BGB wrote:
I fairly promptly fixed this bug once discovered, and am then just left
to wonder how exactly it managed to work in the first place (or didn't
break already).
Been there, done that.
When I set about to revive the then-moribund NCSA Telnet code for
Macintosh, back around 1990, it looked like it had been abandoned because
nobody had the stomach to do the porting from MPW C v2 (created for Apple
by Green Hills) to v3 (developed by Apple itself, thoroughly ANSI-
compliant).
Besides all the compile-time errors, there were dozens, maybe hundreds, of
places to be checked for the different, incompatible definition of the
Pascal-equivalent “Str255” type, to ensure there were no lurking bugs. I
think I got them all.
Then I started up my build, got as far as opening a terminal session,
closed it again, quit ... and the app crashed.
I discovered that the shutdown loop to ensure all open sessions were
closed before quitting had an off-by-1 error in its termination condition:
it was accessing an element in the array of open sessions that didn’t
exist. Somehow this never manifested a problem with the old C compiler,
but it did with the new one.
By the way, that MPW C v3 compiler had some quite amusing error messages.
Various people (including myself) independently posted lists of them (and
once I got accused of plagiarizing the list from someone else--as though
someone had made them up). Quite a few people couldn’t believe such
messages were real.