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

  • SEARCH
  • Home
  • 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 8336489
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T04:00:24+00:00 2026-06-09T04:00:24+00:00

A quote from the C++ Primer, 4th edition: The rules for when an exception

  • 0

A quote from the C++ Primer, 4th edition:

The rules for when an exception matches a catch exception specifier are much more restrictive than the rules used for matching arguments with parameter types. Most conversions are not allowedthe types of the exception and the catch specifier must match exactly with only a few possible differences:

1.Conversions from nonconst to const are allowed. That is, a throw of a nonconst object can match a catch specified to take a const reference.

Could you give me an example to explain the first term? Thanks a lot!

  • 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-06-09T04:00:26+00:00Added an answer on June 9, 2026 at 4:00 am

    Here’s an example

    int main()
    {
      try
      {
        int x = 1;
        throw x;
      }
      catch (const int& e)
      {
        cout << "caught " << e << '\n';
      }
    }
    

    You throw a non-const int, but you catch it with a const int&.

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

Sidebar

Related Questions

Quote from MSDN: If Finalize or an override of Finalize throws an exception, the
To quote from Guidelines and rules for GetHashCode by Eric Lippert: Rule: Consumers of
A quote from MSDN: http://msdn.microsoft.com/en-us/library/6kac2kdh.aspx One or more managed threads (represented by System.Threading.Thread) can
Quote from Wikipedia : A public key token. This is a 64-bit hash of
Quote from Head first html: You can add padding to the top and bottom
Quote from Jason Coco it not possible to set multiple in UILabel... but how
Quote from hib official docs: Starting with version 3.0.1, Hibernate added the SessionFactory.getCurrentSession() method.
I would like to trim a beginning and ending double quote () from a
From 2.13.2/3 The double quote and the question mark ? , can be represented
A quote from MSDN Assigning an instance of this type is not thread safe

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.