This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of CD1 status.

444. Bad use of casts in fstream

Section: 31.10 [file.streams] Status: CD1 Submitter: Vincent Leloup Opened: 2003-11-20 Last modified: 2017-06-15

Priority: Not Prioritized

View all other issues in [file.streams].

View all issues with CD1 status.

Discussion:

31.10.4.4 [ifstream.members] p1, 31.10.5.4 [ofstream.members] p1, 31.10.6.4 [fstream.members] p1 seems have same problem as exposed in LWG issue 252(i).

Proposed resolution:

[Sydney: Genuine defect. 27.8.1.13 needs a cast to cast away constness. The other two places are stylistic: we could change the C-style casts to const_cast. Post-Sydney: Howard provided wording. ]

Change 27.8.1.7/1 from:

Returns: (basic_filebuf<charT,traits>*)&sb.

to:

Returns: const_cast<basic_filebuf<charT,traits>*>(&sb).

Change 27.8.1.10/1 from:

Returns: (basic_filebuf<charT,traits>*)&sb.

to:

Returns: const_cast<basic_filebuf<charT,traits>*>(&sb).

Change 27.8.1.13/1 from:

Returns: &sb.

to:

Returns: const_cast<basic_filebuf<charT,traits>*>(&sb).

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy