git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 03/14] msvc: Fix build by adding missing INTMAX_MAX define

From
Erik Faye-Lund <kusmabite@gmail.com>
Date
Dec 9, 2010, 19:19 UTC
Message-ID
<AANLkTi=_9kT9taLF97cngJ81sBCN9RDkzpk8uN-NW6tG@mail.gmail.com>
In-Reply-To
<4CFA8F1A.3040402@ramsay1.demon.co.uk>
On Sat, Dec 4, 2010 at 7:57 PM, Ramsay Jones <ramsay@ramsay1.demon.co.uk> wrote:
Show 31 quoted lines
>
> Commit c03c831 (do not depend on signed integer overflow,
> 05-10-2010) provokes an msvc build failure. The cause of the
> failure is a missing definition of the INTMAX_MAX constant,
> used in the new maximum_signed_value_of_type(a) macro, which
> would normally be defined in the C99 <stdint.h> header file.
>
> In order the fix the compilation error, we add an appropriate
> definition of the INTMAX_MAX constant, along with INTMAX_MIN
> and UINTMAX_MAX, to an msvc compat header file.
>
> Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
> ---
>  compat/vcbuild/include/unistd.h |    4 ++++
>  1 files changed, 4 insertions(+), 0 deletions(-)
>
> diff --git a/compat/vcbuild/include/unistd.h b/compat/vcbuild/include/unistd.h
> index 2a4f276..b14fcf9 100644
> --- a/compat/vcbuild/include/unistd.h
> +++ b/compat/vcbuild/include/unistd.h
> @@ -45,6 +45,10 @@ typedef unsigned long long uintmax_t;
>
>  typedef int64_t off64_t;
>
> +#define INTMAX_MIN  _I64_MIN
> +#define INTMAX_MAX  _I64_MAX
> +#define UINTMAX_MAX _UI64_MAX
> +
>  #define STDOUT_FILENO 1
>  #define STDERR_FILENO 2
>

Looks good. You only really need to define INTMAX_MAX, but INTMAX_MIN and UINTMAX_MAX are nice additions for future code. I guess you *could* have added UINTMAX_MIN for completeness, but I doubt anyone will ever bother to use it, as it's always 0. So for what it's worth:

Acked-by: Erik Faye-Lund <kusmabite@gmail.com>

In case someone is curious of the definitions; they are documented at http://msdn.microsoft.com/en-us/library/k15zsh48.aspx

Previous: Ramsay Jones
Message 2 of 2 in “msvc: Fix build by adding missing INTMAX_MAX define”
  1. 03/14 msvc: Fix build by adding missing INTMAX_MAX defineRamsay Jones, Dec 4, 2010
  2. Erik Faye-LundDec 9, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.