unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Lynn Winebarger <owinebar@free-expression.org>
Subject: Re: SCM_POSFIXABLE(-1) fails with MSVC++ 6.0
Date: Sun, 25 Aug 2002 11:01:02 -0500	[thread overview]
Message-ID: <02082511010216.19624@locke.free-expression.org> (raw)
In-Reply-To: <20020825132727.GB22670@sim.no>

On Sunday 25 August 2002 08:27, Lars J. Aas wrote:
> Dirk Herrmann <dirk@sallust.ida.ing.tu-bs.de> wrote:
> : 
> : I am not sure I understand the problem here:  is the failure of testing 
> : -1 <= sizeof(long) a compiler bug, or is the strange behaviour defined
> : in the C language?
> 
> I haven't studied the C specification under a microscope, but it has got
> to be a compiler bug.
    Nope.  It's a completely natural consequence or promoting signed to 
unsigned and the 2 values having the same storage size (and that being
the largest that will fit in a register).

>  What I guess is happening is that sizeof() is defined
> to return an unsigned value, and consequently -1 is interpreted as an unsigned
> value.  Exactly how data type qualifiers are supposed to propagate over unary
> tests isn't something I know for sure, but gcc handles it as one would expect.

    Well, I went back and looked at the original code versus what you said
it boils down to (the 3 lines).  With gcc, the first program returns true in both 
cases, but the 2nd (3 lines) prints "not so".  So gcc does get it right.  In the
original code you posted, the right hand side is cast to be a signed value
(scm_t_signed_bits) so it should get compared properly whether the left
hand side is signed or unsigned (and it does). 
     So I guess MSVC has a bug.
     As for the division by sizeof(char), though, I have no idea.  Maybe someone
was working with a non-standards-compliant compiler?

Lynn


_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel


      reply	other threads:[~2002-08-25 16:01 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-08-22 13:30 SCM_POSFIXABLE(-1) fails with MSVC++ 6.0 Lars J. Aas
2002-08-22 13:47 ` Lars J. Aas
2002-08-23 10:40   ` Lars J. Aas
2002-08-24  7:42     ` Dirk Herrmann
2002-08-24 15:57       ` Lynn Winebarger
2002-08-25 13:27       ` Lars J. Aas
2002-08-25 16:01         ` Lynn Winebarger [this message]

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

  List information: https://www.gnu.org/software/guile/

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

  git send-email \
    --in-reply-to=02082511010216.19624@locke.free-expression.org \
    --to=owinebar@free-expression.org \
    /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 read-only IMAP folder(s) and NNTP newsgroup(s).