Error is " functions containing switch are not expanded inline

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • cppcompiler1000
    New Member
    • May 2010
    • 7

    Error is " functions containing switch are not expanded inline

    when i was writing a program in cpp compiler i have got error that " functions containing switch are not expanded inline" what does it mean?
    please tell me.
  • newb16
    Contributor
    • Jul 2008
    • 687

    #2
    Are you sure that it's an error and not just a warning?

    Comment

    • hype261
      New Member
      • Apr 2010
      • 207

      #3
      Inline

      An inline function happens when you declare a function inline or include the function definition inside the body of a class or struct. What an inline function means is that you are telling the compiler to insert the complete body of the function in every place in the code where that function is used. Inline function are used to reduce the time overhead when a function is called specifically the stack pushes and pops. Now just because you declare something to be inline doesn't mean the compilier has to listen to you.

      Basically what your error is telling you is that a function with a switch statement is to compilicated to be inlined. To fix your error move your function definition outside of the class declaration or remove the inline keyword.

      Comment

      • cppcompiler1000
        New Member
        • May 2010
        • 7

        #4
        thanks a lot ! it helps me a lot!

        Comment

        • sweety123shweta
          New Member
          • Jun 2017
          • 1

          #5
          if the function is constructor then....?

          Comment

          Working...