[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: CVS, Cygwin and 'long long'

From: Jim Hyslop
Subject: Re: CVS, Cygwin and 'long long'
Date: Wed, 07 Jun 2006 17:07:15 -0400
User-agent: Mozilla Thunderbird 1.0.6 (Windows/20050716)

Hash: SHA1

Derek R. Price wrote:
> Incidentally, I just compiled the tip of the trunk under Cygwin.  I
> had to add an include file for ULONG_MAX (I've installed the change),
> but other than that, I had no problems.  I'm working on running `make
> check' now.

My apologies, the subject line is actually incorrect. It should be
Visual Studio, not Cygwin. Is it still worth trying to figure out why
strtoulmax doesn't work?

> Derek R. Price wrote:
>>>Jim Hyslop wrote:
>>>>>Currently, the function strto_file_size in src/client.c in the
>>>>>trunk revision calls strtoimax.
>>>Actually, it calls strtoumax.

Sorry again :=) I was going from memory when I wrote the email. I was
away from my Internet connection, and had already made the change.

>>>I doubt reverting this would cause immediate problems, but can we
>>>try to diagnose the current problem completely first?  The GNULIB
>>>replacement strto{i,u}max module should not be using long long if
>>>long long is broken (it should degrade gracefully to using long)
>>>and, if the replacement module is not being used, then Cygwin
>>>should not be defining values for uintmax_t and strtoumax() that
>>>don't work according to POSIX standards
>>>There is also a reasonably solid argument for using strtoumax here,
>>>if possible, since differing platforms may not agree on what the
>>>largest reasonable file size is and parsing correctly anything that
>>>looks like a number allows for slightly more graceful failure

The error I'm getting is at this line:
  verify (sizeof (INT) == sizeof (long int));

Basically, this line is a compile-time check of the sizes. INT boils
down to a typedef of __int64, whereas a long is only 32 bits.

Here's the whole function from strtoimax.c:

strtoimax (char const *ptr, char **endptr, int base)
  verify (sizeof (INT) == sizeof (long int)
          || sizeof (INT) == sizeof (long long int));

  if (sizeof (INT) != sizeof (long int))
    return strtoll (ptr, endptr, base);
  verify (sizeof (INT) == sizeof (long int));

  return strtol (ptr, endptr, base);

Since INT is 64 bits, and strtol returns a 32 bit value, ISTM there
should be no problems changing it to
    verify (sizeof (INT) >= sizeof (long int));

What do you think?

- --
Jim Hyslop
Dreampossible: Better software. Simply.     http://www.dreampossible.ca
                 Consulting * Mentoring * Training in
    C/C++ * OOD * SW Development & Practices * Version Management
Version: GnuPG v1.4.2 (MingW32)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org


reply via email to

[Prev in Thread] Current Thread [Next in Thread]