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

Re: [PATCH 5/7] Define LLONG_MAX/MIN etc if not already defined.

From
Andreas Schwab <schwab@linux-m68k.org>
Date
May 18, 2020, 10:24 UTC
Message-ID
<87a725r16n.fsf@igel.home>
In-Reply-To
<20200518100356.29292-5-dtucker@dtucker.net>
On Mai 18 2020, Darren Tucker wrote:
Show 10 quoted lines
> diff --git a/git-compat-util.h b/git-compat-util.h
> index 8ba576e81e..aa221eba1b 100644
> --- a/git-compat-util.h
> +++ b/git-compat-util.h
> @@ -127,6 +127,22 @@
>  /* Approximation of the length of the decimal representation of this type. */
>  #define decimal_length(x)	((int)(sizeof(x) * 2.56 + 0.5) + 1)
>  
> +#ifndef SIZE_MAX
> +#define SIZE_MAX ((size_t)maximum_signed_value_of_type(size_t))
size_t is an unsigned type.
Show 13 quoted lines
> +#endif
> +
> +#ifndef LLONG_MIN
> +#define LLONG_MIN ((long long)minimum_signed_value_of_type(long long))
> +#endif
> +
> +#ifndef LLONG_MAX
> +#define LLONG_MAX ((long long)maximum_signed_value_of_type(long long))
> +#endif
> +
> +#ifndef ULLONG_MAX
> +#define ULLONG_MAX ((unsigned long long)maximum_unsigned_value_of_type(unsigned long long))
> +#endif

These definitions won't work in the preprocessor. The are no current uses of these macros in preprocessor directives, but that needs to be kept in mind.

Andreas.
-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."
Previous: Darren TuckerNext: Darren Tucker
Message 5 of 24 in “Redirect grep's stderr top null too.”
  1. 1/7 Redirect grep's stderr top null too.Darren Tucker, May 18, 2020
  2. 4/7 Use strtoumax instead of strtoull.Darren Tucker, May 18, 2020
  3. Junio C HamanoMay 18, 2020
  4. 5/7 Define LLONG_MAX/MIN etc if not already defined.Darren Tucker, May 18, 2020
  5. Andreas SchwabMay 18, 2020
  6. Darren TuckerMay 18, 2020
  7. 6/7 Check if strtoumax is a macro (eg HP-UX 11.11).Darren Tucker, May 18, 2020
  8. Junio C HamanoMay 18, 2020
  9. Darren TuckerMay 20, 2020
  10. Junio C HamanoMay 20, 2020
  11. 2/7 Define NO_PREAD for HPUX 11.11 and 11.00.Darren Tucker, May 18, 2020
  12. 3/7 Test for strtoull in configure.Darren Tucker, May 18, 2020
  13. 7/7 Define SCNuMAX if not already defined.Darren Tucker, May 18, 2020
  14. Đoàn Trần Công DanhMay 18, 2020
  15. Darren TuckerMay 18, 2020
  16. Đoàn Trần Công DanhMay 18, 2020
  17. Darren TuckerMay 18, 2020
  18. t5703: replace "grep -a" usage by perlĐoàn Trần Công Danh, May 19, 2020
  19. Darren TuckerMay 19, 2020
  20. Christian CouderMay 19, 2020
  21. Đoàn Trần Công DanhMay 19, 2020
  22. Christian CouderMay 19, 2020
  23. Eric SunshineMay 19, 2020
  24. Junio C HamanoMay 18, 2020

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.