all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Francis Litterio <flitterio@gmail.com>
To: Andreas Schwab <schwab@suse.de>, 722@emacsbugs.donarmstrong.com
Subject: bug#722: More Visual Studio 6.0 compiler errors on Windows XP
Date: Fri, 15 Aug 2008 09:35:11 -0400	[thread overview]
Message-ID: <u3al674qz.fsf@gmail.com> (raw)
In-Reply-To: <mailman.16775.1218793661.18990.bug-gnu-emacs@gnu.org> (Andreas Schwab's message of "Fri\, 15 Aug 2008 11\:33\:32 +0200")

Andreas Schwab wrote:

> Francis Litterio writes:
>
>> --- dired.c~	2008-08-14 17:09:53.759788900 -0400
>> +++ dired.c	2008-08-14 17:13:16.585787100 -0400
>> @@ -961,7 +961,7 @@
>>    values[7] = make_number (s.st_size);
>>    /* If the size is out of range for an integer, return a float.  */
>>    if (XINT (values[7]) != s.st_size)
>> -    values[7] = make_float ((double)s.st_size);
>> +    values[7] = make_float ((signed __int64)s.st_size);
>
> Tell Microsoft to fix their compiler, you are changeing perfectly valid
> C into unportable junk.

You are preaching to the choir. :) I just want a clean build on Windows.
Emacs has always compiled using VC++ 6.0 in the past, so some change
must have introduced this problem.

I forgot that dired.c is not Windows-only code, so this patch is more
correct:

--- dired.c~	31 Jul 2008 05:33:51 -0000	1.153
+++ dired.c	15 Aug 2008 14:04:04 -0000
@@ -961,7 +961,11 @@
   values[7] = make_number (s.st_size);
   /* If the size is out of range for an integer, return a float.  */
   if (XINT (values[7]) != s.st_size)
+#if defined(WINDOWSNT)
+    values[7] = make_float ((signed __int64)s.st_size);
+#else
     values[7] = make_float ((double)s.st_size);
+#endif
   /* If the size is negative, and its type is long, convert it back to
      positive.  */
   if (s.st_size < 0 && sizeof (s.st_size) == sizeof (long))

Also, a 64-bit integer (signed or unsigned) cannot safely be cast to
double without loss of data.  An IEEE 754 64-bit floating value only has
52-bits of mantissa.  So the non-Windows implementation is not 100%
correct either.
--
Fran






  parent reply	other threads:[~2008-08-15 13:35 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-14 21:11 bug#722: More Visual Studio 6.0 compiler errors on Windows XP Francis Litterio
2008-08-15  9:33 ` Andreas Schwab
2008-08-15 12:33 ` Eli Zaretskii
     [not found] ` <mailman.16775.1218793661.18990.bug-gnu-emacs@gnu.org>
2008-08-15 13:35   ` Francis Litterio [this message]
2008-08-15 16:17     ` Eli Zaretskii
2008-08-15 16:39       ` Fran Litterio
2008-08-15 17:02         ` Eli Zaretskii
     [not found] ` <mailman.16795.1218804458.18990.bug-gnu-emacs@gnu.org>
2008-08-15 14:20   ` Francis Litterio
2008-08-15 17:09     ` Eli Zaretskii
2008-08-15 19:35 ` Stefan Monnier

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=u3al674qz.fsf@gmail.com \
    --to=flitterio@gmail.com \
    --cc=722@emacsbugs.donarmstrong.com \
    --cc=schwab@suse.de \
    /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.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.