9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: "Boyd Roberts" <boyd@fr.inter.net>
To: <9fans@cse.psu.edu>
Subject: Re: [9fans] another compiler bug (another try to send this coherently)
Date: Mon, 16 Jul 2001 21:47:54 +0200	[thread overview]
Message-ID: <022b01c10e30$34a40cb0$3cf7c6d4@SOMA> (raw)
In-Reply-To: <200107161921.f6GJL7c10659@ducky.net>

From: "Mike Haertel" <mike@ducky.net>
> I'm not actually trying to do anything that depends on this.
> I have been writing some high-performance AES (Rijndael) encryption
> routines lately.

yeah, i know what AES is.

> I decided the portability problems associated
> with relying on compilers getting the ANSI C rules exactly right
> were too much of a headache, so I went through the code to put in
> explicit casts anywhere implicit conversions would otherwise occur,
> to prevent broken compilers (like 8c) from doing the Wrong Thing.

ahh, that little tin god efficiency.  why didn't you _write_ the
code that way in the first place?

> I was reviewing my code, with the help of "8c -t" to print the
> parse trees and make sure there were no implicit promotions left,
> when I stumbled across a few more I had overlooked, and noticed
> moreover that 8c was inserting "CAST UINT" in places where ANSI
> says it should have inserted "CAST INT".  So I reported it as a bug.

don't you think that posting the above paragraph would have more
useful?

> It wasn't causing me any trouble,

it did, by your own admission.

> but I think these things should be fixed whenever you find them.

sure, but, i'm not sure plan 9 gets it _wrong_.

doug will probably disagree, but i know why.  i guess the ANSI
reasoning went:

    chars get promoted to int.  trouble is that whether they
    where signed or not was undefined,  so they all got
    promoted to int.

i think this is wrong.  they should have preserved their
unsigned property if they were declared as unsigned.  in
a char decl, well make a choice:

    - make it implementation dependant
    - declare 'em to be signed by definition

language law -- i hate it.





  reply	other threads:[~2001-07-16 19:47 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-07-14  3:26 Mike Haertel
2001-07-16  9:05 ` Douglas A. Gwyn
2001-07-16  9:38   ` Boyd Roberts
2001-07-16 18:34   ` Mike Haertel
2001-07-16 18:52     ` Boyd Roberts
2001-07-16 19:21       ` Mike Haertel
2001-07-16 19:47         ` Boyd Roberts [this message]
2001-07-17 15:16         ` Douglas A. Gwyn
2001-07-16 11:13 rog
2001-07-16 12:51 ` Boyd Roberts
2001-07-16 13:41   ` Boyd Roberts
2001-07-16 13:44   ` Boyd Roberts
2001-07-17 15:51 forsyth
2001-07-18  8:43 ` Douglas A. Gwyn

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='022b01c10e30$34a40cb0$3cf7c6d4@SOMA' \
    --to=boyd@fr.inter.net \
    --cc=9fans@cse.psu.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).