diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2025-07-01 21:50:05 +0200 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2025-07-01 21:50:05 +0200 |
commit | 40e985ddcd987968150d3c3b66fa2febdf4f5d97 (patch) | |
tree | 5d146bfe6e4d8562eab0191dd9d4d9cfae66bb4e /faq | |
parent | 8f5b486a1e332b0eee1d66d5475f290f9a42e17f (diff) |
Quote standard for FOO_MAX being optional
Diffstat (limited to 'faq')
-rw-r--r-- | faq/foo_max.mdwn | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/faq/foo_max.mdwn b/faq/foo_max.mdwn index cf5f80ba..ccd09904 100644 --- a/faq/foo_max.mdwn +++ b/faq/foo_max.mdwn @@ -18,7 +18,12 @@ For porting guidelines, see [[hurd/porting/guidelines#PATH_MAX_tt_MAX_PATH_tt_MA # Is it really standard not to define them? -These macros are indeed optional in Posix, so not defining them remains standard-compliant. +These macros are indeed optional in Posix, so not defining them remains +standard-compliant. Quoting the standard: + + A definition of one of the symbolic constants in the following list shall be + omitted from <limits.h> on specific implementations where the corresponding + value is equal to or greater than the stated minimum, but is unspecified. Their definition was actually not completely clear, Posix 1990 was ambiguous about it including `\0` or not, it was made clear later on that it does include @@ -30,7 +35,7 @@ even depend on its revision, so to be rather queried at runtime with `pathconf`. # But it's really convenient! Isn't allocating dynamically much more complex? `FOO_MAX` constants are most often used as “reasonable size to allocate a -path”. On Linux it is typically 4096, which is not that reasonable (a whole +path”. On Linux `PATH_MAX` is typically 4096, which is not that reasonable (a whole memory page, thus a TLB lookup) when manipulating a lot of paths. Allocating dynamically would use much less memory. |