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 6152377
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T19:54:35+00:00 2026-05-23T19:54:35+00:00

I recently saw something interesting in some c++ code: try { //doStuff } catch

  • 0

I recently saw something interesting in some c++ code:

try {
   //doStuff
} catch ( ... ) {
  //doStuff
}

The “…” is what I’m referring to.

Now, at first glance one might think that this is nothing more than a filler, like a comment similar to the “doStuff” we see. The weird thing is that typing this in the Eclipse CDT actually works, without giving any syntax errors.

Is there a special purpose for this at all?

  • 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-23T19:54:36+00:00Added an answer on May 23, 2026 at 7:54 pm

    As others have mentioned, it catches everything. From what I’ve seen, this is mostly used when you can’t identify the actual exception that is thrown. And this could happen if that exception is a Structured Exception, which is not a C++ one. For instance, if you try to access some invalid memory location. It is usually not a good habit to use those “catch all”s. You don’t have a (portable) way to get a stack trace, and you don’t know anything about the exception thrown.

    Using this for reasons other than examples or very trivial cases might indicate the author is trying to hide the program’s instability by not taking proper care of unrecognized exceptions. If you ever face such a case, you better let the program crash, and create a crash dump you can analyze later. Or, use a structured exception handler (In case you’re using VS – don’t know how this is done on other compilers).

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

Sidebar

Related Questions

I recently saw some code from a college teacher where he had something like
I recently saw someone with a T-shirt with some Perl code on the back.
I recently saw some code that reminded me to ask this question. Lately, I've
Recently I saw some code like this: <tr> <th> Some label: </th> <td> <input
In some code I saw recently there was a structure defined like this: typedef
I recently saw some Perl code that confused me. I took out all of
Saw an interesting piece of code recently, and my mind made a snap judgement
I recently saw a bit of code that looked like this (with sock being
i recently saw some videos on F#. it seems it used mainly for Service
I recently saw some Clojure or Scala (sorry I'm not familiar with them) and

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.