[diff.cpp20.utilities]

# Annex C (informative) Compatibility [[diff]](./#diff)

## C.2 C++ and ISO C++ 2020 [[diff.cpp20]](diff.cpp20#utilities)

### C.2.10 [[utilities]](utilities "22 General utilities library"): general utilities library [diff.cpp20.utilities]

[1](#1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/compatibility.tex#L673)

**Affected subclause:** [[format]](format)  


**Change:** Signature changes: format, format_to, vformat_to,format_to_n, formatted_size[.](#1.sentence-1)

Removal of format_args_t[.](#1.sentence-2)

  


**Rationale:** Improve safety via compile-time format string checks,
avoid unnecessary template instantiations[.](#1.sentence-3)

  


**Effect on original feature:** Valid C++ 2020 code that
contained errors in format strings or
relied on previous format string signatures orformat_args_t may become ill-formed[.](#1.sentence-4)

[*Example [1](#example-1)*: auto s = std::format("{:d}", "I am not a number"); // ill-formed,// previously threw format_error â *end example*]

[2](#2)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/compatibility.tex#L693)

**Affected subclause:** [[format]](format)  


**Change:** Signature changes: format, format_to, format_to_n,formatted_size[.](#2.sentence-1)

  


**Rationale:** Enable formatting of views
that do not support iteration when const-qualified and
that are not copyable[.](#2.sentence-2)

  


**Effect on original feature:** Valid C++ 2020 code that passes bit-fields to formatting functions
may become ill-formed[.](#2.sentence-3)

[*Example [2](#example-2)*: struct tiny {int bit: 1;};

auto t = tiny();
std::format("{}", t.bit); // ill-formed, previously returned "0" â *end example*]

[3](#3)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/compatibility.tex#L715)

**Affected subclause:** [[format.string.std]](format.string.std)  


**Change:** Restrict types of formatting arguments
used as *width* or *precision* in
a *std-format-spec*[.](#3.sentence-1)

  


**Rationale:** Disallow types that do not have useful or portable semantics as
a formatting width or precision[.](#3.sentence-2)

  


**Effect on original feature:** Valid C++ 2020 code that passes a boolean or character type as*arg-id* becomes invalid[.](#3.sentence-3)

[*Example [3](#example-3)*: std::format("{:*^{}}", "", true); // ill-formed, previously returned "*" std::format("{:*^{}}", "", '1'); // ill-formed, previously returned an// implementation-defined number of '*' characters â *end example*]

[4](#4)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/compatibility.tex#L734)

**Affected subclause:** [[format.formatter.spec]](format.formatter.spec)  


**Change:** Removed the formatter specialization:template<size_t N> struct formatter<const charT[N], charT>;  

**Rationale:** The specialization is inconsistent with the design of formatter,
which is intended to be instantiated only with cv-unqualified object types[.](#4.sentence-2)

  


**Effect on original feature:** Valid C++ 2020 code that instantiated the removed specialization
can become ill-formed[.](#4.sentence-3)
