This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] manual: Document %m instead of %a for formatted input.


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]