Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7532751
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T05:32:38+00:00 2026-05-30T05:32:38+00:00

Every definition I’ve seen of function ios::setstate( iostate state ) shows that the function

  • 0

Every definition I’ve seen of function ios::setstate( iostate state ) shows that the function takes ONE and ONLY ONE parameter yet when I compile a program with the following function call, everything compiles and runs just fine:

mystream.setstate( std::ios_base::badbit, true );

What exactly is the second parameter and why is there no documentation about it?

EDIT: I’m using the command line compiler of the latest version of Microsoft Visual Studio 2010.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T05:32:39+00:00Added an answer on May 30, 2026 at 5:32 am

    It’s required to accept a single argument, as you’ve noted, but implementations are allowed to extend member functions via parameters with default values (§17.6.5.5). In other words, as long as this works:

    mystream.setstate( std::ios_base::badbit );
    

    your compiler is conforming. Nothing says that your code doesn’t have to work, though.

    (Your library implementation has decided that a boolean parameter would be useful to have. You never notice it because it has a default value, but you can still get into implementation-specific territory and provide the argument yourself. Whether or not this is a good idea is obviously another question, but probably not.)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Every time I create an object that has a collection property I go back
in Python script, for every method definition in some C++ code of the form:
Isn't it true that every assert statement can be translated to an Assert.IsTrue, since
I wrote a filter that needs to be invoked every time a url on
When I declare a function in a header file, and put the definition of
I have been working at a few different companies now and every one has
We know every set's definition from the union of other sets. For example A
If the Single Responsibility Principle states that every object must have a single reason
I know this is a question that every programmer should know, but I do
According to the definition of callback in JQuery pagination plugin's documents. It seems that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.