Sponsored Content
Full Discussion: C++ Exception class missing?
Top Forums Programming C++ Exception class missing? Post 302653107 by Corona688 on Friday 8th of June 2012 11:58:37 AM
Old 06-08-2012
That code was written for Microsoft Windows in Visual C++ 6, and Microsoft compilers and libraries tend to have many nonstandard features and extensions. Portably-written code will usually compile in a Microsoft compiler, but programmers who don't know better can make code written in Microsoft compilers very hard to port. Things like this:

Code:
for(int i=0; i<10; i++) { ... }

Declaring variables inside a for-loop like this used to be a nonstandard feature, and caused many headaches for programmers trying to port code written in Visual C++.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Exception while loading DB2 driver Class.forName("com.ibm.db2.jcc.DB2Driver")

Hi... I m working on UNIX z/OS. Actually i have to pass the parameters from the JCL to java-db2 program thru PARM. I am able to pass the arguments but the problem occured is, it is throwing an exception while loading the db2 driver as 'Javaclassnotfound:com.ibm.db2.jcc.DB2Driver'... (0 Replies)
Discussion started by: Sujatha Gowda
0 Replies

2. UNIX for Dummies Questions & Answers

car class (not school class)

im just trying to have some fun and kill some time writing a c++ program that has a person type in a car make and model then gives them a year and a price. or something like that. i always have problems getting it goin but once the ball is rolling im usually pretty good. anyone wanna help me out? ... (1 Reply)
Discussion started by: rickym2626
1 Replies

3. Programming

C++ class definition with a member of the same class

Hi, i have a question about C++. Is it possible to declare a class with a member ot the same class? For example, a linked list or i want to convert this C code to C++ class (Elemento) typedef struct elemento { char name; char value; List<struct elemento> ltElementos; ... (7 Replies)
Discussion started by: pogdorica
7 Replies

4. Programming

static use for class inside the same class c++

Hi, I believe the next code is wrong: class Egg { Egg e; int i; Egg(int ii=0) : i(ii) {} }; because you would end up with an endless definition (memory allocation) of Egg objects, thus int i. Ok, so God Eckel proposes for a singleton: class Egg { static Egg e; int... (5 Replies)
Discussion started by: xavipoes
5 Replies

5. UNIX for Advanced & Expert Users

Get pointer for existing device class (struct class) in Linux kernel module

Hi all! I am trying to register a device in an existing device class, but I am having trouble getting the pointer to an existing class. I can create a class in a module, get the pointer to it and then use it to register the device with: *cl = class_create(THIS_MODULE, className);... (0 Replies)
Discussion started by: hdaniel@ualg.pt
0 Replies

6. Shell Programming and Scripting

Monitor logs for exception and if exception come then sent an email

Hi Folks, please advise , I have logs generated on unix machine at location /ops/opt/aaa/bvg.log , now sometimes there come exception in these logs also, so I want to write such a script such that it should continuously monitor these logs and whenever any exception comes that is it try to find... (3 Replies)
Discussion started by: tuntun27272727
3 Replies

7. Programming

Size of Derived class, upon virtual base class inheritance

I have the two class definition as follows. class A { public: int a; }; class B : virtual public A{ }; The size of class A is shown as 4, and size of class B is shown as 16. Why is this effect ?. (2 Replies)
Discussion started by: techmonk
2 Replies

8. SuSE

How to resolve missing missing dependencies with opensuse 11.3 and 12.3?

Hello, This is a programming question as well as a suse question, so let me know if you think I should post this in programming. I have an application that I compiled under opensuse 12.2 using g77-3.3/g++3.3. The program compiles and runs just fine. I gave the application to a colleague who... (2 Replies)
Discussion started by: LMHmedchem
2 Replies

9. Red Hat

Yum - resolving missing dependencies that are not missing

I am trying to install VirtualBox on RHEL 5 but I need the 32 bit version for 32 bit Windows. When I run yum I get the following: sudo yum localinstall /auto/spvtg-it/spvss-migration/Software/VirtualBox-4.3-4.3.2_90405_el6-1.i686.rpm Loaded plugins: fastestmirror Setting up Local Package... (13 Replies)
Discussion started by: gw1500se
13 Replies

10. Programming

C++ : Base class member function not accessible from derived class

Hello All, I am a learner in C++. I was testing my inheritance knowledge with following piece of code. #include <iostream> using namespace std; class base { public : void display() { cout << "In base display()" << endl; } void display(int k) {... (2 Replies)
Discussion started by: anand.shah
2 Replies
Dancer::Exception(3pm)					User Contributed Perl Documentation				    Dancer::Exception(3pm)

NAME
Dancer::Exception - class for throwing and catching exceptions SYNOPSIS
use Dancer::Exception qw(:all); register_exception('DataProblem', message_pattern => "test message : %s" ); sub do_stuff { raise DataProblem => "we've lost data!"; } try { do_stuff() } catch { # an exception was thrown my ($exception) = @_; if ($exception->does('DataProblem')) { # handle the data problem my $message = $exception->message(); } else { $exception->rethrow } }; DESCRIPTION
Dancer::Exception is based on Try::Tiny. You can try and catch exceptions, like in Try::Tiny. Exceptions are objects, from subclasses of Dancer::Exception::Base. However, for internal Dancer usage, we introduce a special class of exceptions, called Dancer::Continuation. Exceptions that are from this class are not caught with a "catch" block, but only with a "continuation". That's a cheap way to implement a workflow interruption. Dancer users should ignore this feature. What it means for Dancer users Users can throw and catch exceptions, using "try" and "catch". They can reuse some Dancer core exceptions ("Dancer::Exception::Base::*"), but they can also create new exception classes, and use them for their own means. That way it's easy to use custom exceptions in a Dancer application. Have a look at "register_exception", "raise", and the methods in Dancer::Exception::Base. METHODS
try Same as in Try::Tiny catch Same as in Try::Tiny. The exception can be retrieved as the first parameter: try { ... } catch { my ($exception) = @_; }; continuation To be used by Dancer developers only, in Dancer core code. raise # raise Dancer::Exception::Base::Custom raise Custom => "user $username is unknown"; # raise Dancer::Exception::Base::Custom::Frontend raise 'Custom::Frontend' => "user $username is unknown"; # same, raise Dancer::Exception::Base::Custom::Frontend raise custom_frontend => "user $username is unknown"; # raise My::Own::ExceptionSystem::Invalid::Login raise '+My::Own::ExceptionSystem::Invalid::Login' => "user $username is unknown"; raise provides an easy way to throw an exception. First parameter is the name of the exception class, without the "Dancer::Exception::" prefix. other parameters are stored as raising arguments in the exception. Usually the parameters is an exception message, but it's left to the exception class implementation. If the exception class name starts with a "+", then the "Dancer::Exception::" won't be added. This allows one to build their own exception class hierarchy, but you should first look at "register_exception" before implementing your own class hierarchy. If you really wish to build your own exception class hierarchy, we recommend that all exceptions inherit of Dancer::Exception::. Or at least it should implement its methods. The exception class can also be written as words separated by underscores, it'll be camelized automatically. So 'Exception::Foo' and 'exception_foo' are equivalent. Be careful, 'MyException' can't be written 'myexception', as it would be camelized into 'Myexception'. register_exception This method allows one to register custom exceptions, usable by Dancer users in their route code (actually pretty much everywhere). # simple exception register_exception ('InvalidCredentials', message_pattern => "invalid credentials : %s", ); This registers a new custom exception. To use it, do: raise InvalidCredentials => "user Herbert not found"; The exception message can be retrieved with the "$exception-"message> method, and we'll be "invalid credentials : user Herbert not found" (see methods in Dancer::Exception::Base) # complex exception register_exception ('InvalidLogin', composed_from => [qw(Fatal InvalidCredentials)], message_pattern => "wrong login or password", ); In this example, the "InvalidLogin" is built as a composition of the "Fatal" and "InvalidCredentials" exceptions. See the "does" method in Dancer::Exception::Base. registered_exceptions my @exception_classes = registered_exceptions; Returns the list of exception class names. It will list core exceptions "and" custom exceptions (except the one you've registered with a leading "+", see "register_exception"). The list is sorted. GLOBAL VARIABLE
$Dancer::Exception::Verbose When set to 1, exceptions will stringify with a long stack trace. This variable is similar to $Carp::Verbose. I recommend you use it like that: local $Dancer::Exception::Verbose; $Dancer::Exception::Verbose = 1; All the Carp global variables can also be used to alter the stacktrace generation. perl v5.14.2 2012-03-31 Dancer::Exception(3pm)
All times are GMT -4. The time now is 11:46 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy