From 40e985ddcd987968150d3c3b66fa2febdf4f5d97 Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Tue, 1 Jul 2025 21:50:05 +0200 Subject: Quote standard for FOO_MAX being optional --- faq/foo_max.mdwn | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'faq') 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 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. -- cgit v1.2.3