C++Talk.NET Forum Index C++Talk.NET
C++ language newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

throw "bidule"

 
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ (French)
View previous topic :: View next topic  
Author Message
Fabien LE LEZ
Guest





PostPosted: Sun Feb 06, 2005 4:02 pm    Post subject: throw "bidule" Reply with quote



Bonjour,

J'ai un peu de mal avec le type d'une chaîne littérale. Si j'écris

try
{
throw "foo";
}
catch (XXX)
{
}

quelles sont les valeurs de "XXX" qui feront que l'exception sera
attrapée ?

Merci d'avance...



--
Wink
Back to top
Frederic Py
Guest





PostPosted: Sun Feb 06, 2005 4:30 pm    Post subject: Re: throw "bidule" Reply with quote



On 2005-02-06 17:02:52 +0100, Fabien LE LEZ <gramster (AT) gramster (DOT) com> said:

Quote:
Bonjour,

J'ai un peu de mal avec le type d'une chaîne littérale. Si j'écris
try {
throw "foo";
}
catch (XXX)
{
}

quelles sont les valeurs de "XXX" qui feront que l'exception sera
attrapée ?

Merci d'avance...

A priori je dirait char * etant donné que "foo" est un char[]
--
Fred


Back to top
David
Guest





PostPosted: Sun Feb 06, 2005 4:45 pm    Post subject: Re: throw "bidule" Reply with quote



Salut,
comme "foo" est un const char*
fort probablement :

XXX = const char*
ou
XXX = ...



Fabien LE LEZ a écrit :
Quote:
Bonjour,

J'ai un peu de mal avec le type d'une chaîne littérale. Si j'écris

try
{
throw "foo";
}
catch (XXX)
{
}

quelles sont les valeurs de "XXX" qui feront que l'exception sera
attrapée ?

Merci d'avance...




Back to top
Falk Tannhäuser
Guest





PostPosted: Sun Feb 06, 2005 7:46 pm    Post subject: Re: throw "bidule" Reply with quote

Fabien LE LEZ wrote:
Quote:
J'ai un peu de mal avec le type d'une chaîne littérale. Si j'écris

try
{
throw "foo";
}
catch (XXX)
{
}

quelles sont les valeurs de "XXX" qui feront que l'exception sera
attrapée ?

"foo" est du type 'char const[4]' qui d'après § 15.1/3 est ajusté
en 'char const*'. L'exception ne sera donc pas attrapée par un
'catch(char*)' mais elle l'est par un 'catch(char const*)', un
'catch(void const*)' ou un 'catch(...)'.

Falk

Back to top
Display posts from previous:   
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ (French) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.