1
  SVector.H:

  void pop_back() throw (underflow_error);

In my SVector.cpp file, should I also include the throw (underflow_error) part as well?

void pop_back() throw (underflow_error)
{
    // implementation
}

OR

void pop_back()
{
    // implementation
}

Thanks.

kevin
  • 1,834
  • 3
  • 18
  • 23
  • Personally, I hate throw() statements. You might be interested in this: http://stackoverflow.com/questions/88573/should-i-use-an-exception-specifier-in-c – SoapBox Mar 13 '10 at 01:41
  • 1
    You might be interested in this article by Herb Sutter (http://www.gotw.ca/publications/mill22.htm): Moral #1: Never write an exception specification. Moral #2: Except possibly an empty one, but if I were you I’d avoid even that. – James McNellis Mar 13 '10 at 05:31

1 Answers1

8

15.4/2:

If any declaration of a function has an exception-specification, all declarations, including the definition and an explicit specialization, of that function shall have an exception-specification with the same set of type-ids.

Johannes Schaub - litb
  • 496,577
  • 130
  • 894
  • 1,212