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 sans paramètre

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





PostPosted: Thu Aug 07, 2003 3:05 pm    Post subject: throw sans paramètre Reply with quote



Bonjour,

J'ai constaté avec surprise que le bout de code suivant compile avec VC6
(qui n'est pas une référence du respect des standards) et avec g++ 3.2
(avec "-Wall -ansi -pedantic"):

void doit()
{
throw;
}

Mais quel peut-il bien se passer dans le cas où la fonction "doit" n'est
pas appelée dans un bloc "catch" ? Une exception de type inconnu,
attrapable uniquement par un "catch(...)" ?

Fabien

Back to top
Patrick Mézard
Guest





PostPosted: Thu Aug 07, 2003 5:44 pm    Post subject: Re: throw sans paramètre Reply with quote



Quote:
void doit()
{
throw;
}

Mais quel peut-il bien se passer dans le cas où la fonction "doit" n'est
pas appelée dans un bloc "catch" ? Une exception de type inconnu,
attrapable uniquement par un "catch(...)" ?

Fabien


Ca appelle std::terminate, il me semble.

Patrick Mézard



Back to top
Fabien SK
Guest





PostPosted: Fri Aug 08, 2003 9:21 am    Post subject: Re: throw sans paramètre Reply with quote



Patrick Mézard wrote:
Quote:
void doit()
{
throw;
}

Mais quel peut-il bien se passer dans le cas où la fonction "doit" n'est
pas appelée dans un bloc "catch" ? Une exception de type inconnu,
attrapable uniquement par un "catch(...)" ?

Fabien


Ca appelle std::terminate, il me semble.

Patrick Mézard


Oui, ça je savais déjà qu'une exception non attrapée provoque l'appel de
"std::terminate" Smile Mais la question était: quel est ce type
d'exception. Si je fais:

int main(int argc, char *argv)
{
try
{
throw;
}
catch(...)
{
// quel est le type de l'exception ici ? ?
}
}

Le "throw" n'a pas pu redéclencher une exception existante....

Fabien


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.