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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T03:37:38+00:00 2026-06-10T03:37:38+00:00

Does C++11 give any guarantees about inline functions or methods, when they make calls

  • 0

Does C++11 give any guarantees about inline functions or methods, when they make calls to other functions declared with the noexcept qualifier?

class My_String { ...

    const char * c_str () const noexcept;
    inline operator const char * () const { return c_str(); }
};

I assume an optimizing compiler would be free to implement the inline method without full EH and stack unwinding, as per the noexcept qualification. I would also expect this for a simple accessor method too:

... inline operator const char * () const { return m_buffer; }

While this example looks trivial, exception guarantees matter when used to implement other classes or functions. Q: Does the C++11 standard address this or should inline methods be marked noexcept? Or is it better to omit noexcept unless required to match a class or function specification?

Edit: To avoid some confusion: Is noexcept implicit for the inline method?

  • 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-10T03:37:39+00:00Added an answer on June 10, 2026 at 3:37 am

    Sorry, no. The only implicit exception-specifications are

    • On destructors.
    • On other implicitly declared or explicitly defaulted special member functions: default constructors, copy and move constructors, and copy and move assignment, when not declared in a class definition, or declared with = default;.
    • On deallocation functions: operator delete and operator delete[].

    [Note that for deallocation functions, an implicit exception-specification is always as if noexcept(true). For all destructors, and for special member functions which are implicitly declared or explicitly defaulted on the first declaration, the implicit exception-specification can be either noexcept(true) or noexcept(false), as determined from the exception-specifications of the corresponding special member functions of any base classes and members of class type.]

    So with either example declaration, noexcept(static_cast<const char*>(std::declval<const MyString>())) must be false. Go ahead and write noexcept where it might matter.

    Of course, as you noted, a compiler optimization is still allowed to notice an inline function can’t throw exceptions and simplify exception handling in the caller.

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

Sidebar

Related Questions

I understand that the C specification does not give any specification about the specific
I have a table name that starts with an underscore does that give any
Does anyone know of any resources that can give me an idea of how
I have an issue with generic interface. The compiler does not give any compiling
Why this does not give any records in sql server 2008? ;with pricedCategories as
I have made strstr() function but the program does not give any output,just a
I am using Zend_Db with the Pdo_Mysql driver. This query does not give any
The following code does not give a warning with g++ 4.1.1 and -Wall .
Look at this code: class MyClass(): # Why does this give me NameError: name
I want to disable or also I have does not give permission entering the

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.