runtime_error type advise

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I'm new to the list and have just recently started using Gcc (or
specifically in this case g++). I've been working through a book on c++
and have *bumped* a problem concerning runtime_error types. In the book
(which claims to use only ISO standard c++ libs so that the program code
should run on any compiler -- including, he says, gcc) the following
function definition is given :

int HandleRuntimeError(runtime_error theRuntimeError)
	{
		std::cerr << theRuntimeError.what() << endl;
		return 1;

	} 

The author says that "runtime_error" is a *type* but Gcc compiler
doesn't recognize it as a type at all. He didn't give the prototype
definition in the book for the header file. So I defined it in there as:

	int HandleRuntimeError(runtime_error);

I included #include <exception> in both the header and implementation
files and I searched in my :/usr/include/c++/3.2 (redhat 8.0) and found
a library called "exception" and read through it, but I was a *bit*
confused by it all. I then entered the code in visual c++ (v6.0) and it
didn't complain about the use of the definition and declarations that
used the *runtime_error* (i.e. as above). However, visual c++ complained
like mad about namespace defs -- which gcc didn't :-?.   

So my query is: how do I declare the equivalent *runtime_error* type in
g++ guys?

Cheers --- Tony. 



Attachment: signature.asc
Description: This is a digitally signed message part


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux