This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] manual: Document %m instead of %a for formatted input.
- From: "Joseph S. Myers" <joseph at codesourcery dot com>
- To: OndÅej BÃlka <neleai at seznam dot cz>
- Cc: Roland McGrath <roland at hack dot frob dot com>, Ville Skytta <ville dot skytta at iki dot fi>, <libc-alpha at sourceware dot org>
- Date: Wed, 19 Feb 2014 14:40:23 +0000
- Subject: Re: [PATCH] manual: Document %m instead of %a for formatted input.
- Authentication-results: sourceware.org; auth=none
- References: <20140211140022 dot GB22794 at domone dot podge> <20140211173249 dot 9BA1174451 at topped-with-meat dot com> <20140219135720 dot GD29125 at domone dot podge>
On Wed, 19 Feb 2014, Ondrej Bilka wrote:
> @@ -3929,18 +3933,21 @@ input with a comprehensible error message, not with a crash.
> @node Dynamic String Input
> @subsection Dynamically Allocating String Conversions
>
> -A GNU extension to formatted input lets you safely read a string with no
> -maximum size. Using this feature, you don't supply a buffer; instead,
> -@code{scanf} allocates a buffer big enough to hold the data and gives
> -you its address. To use this feature, write @samp{a} as a flag
> -character, as in @samp{%as} or @samp{%a[0-9a-z]}.
> +Since ISO C-1990 there is feature to safely read a string with no maximum
> +size. Using this feature, you don't supply a buffer; instead, @code{scanf}
> +allocates a buffer big enough to hold the data and gives you its address.
> +To use this feature, write @samp{m} as a flag character, as in
> +@samp{%ms}, @samp{%m10c} or @samp{%m[0-9a-z]}.
It's not C90, or C99, or C11. It's a POSIX (new in the 2008 edition)
feature, also present in the C TR 24731-2:2010 which was not (unlike
24731-1) integrated in C11.
--
Joseph S. Myers
joseph@codesourcery.com