From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12810 invoked by alias); 2 Jun 2011 03:07:59 -0000 Received: (qmail 12798 invoked by uid 22791); 2 Jun 2011 03:07:57 -0000 X-SWARE-Spam-Status: No, hits=3.2 required=5.0 tests=AWL,BAYES_50,DKIM_ADSP_CUSTOM_MED,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,MISSING_HEADERS,NML_ADSP_CUSTOM_MED,RCVD_IN_DNSWL_LOW,RFC_ABUSE_POST,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: sourceware.org Received: from mail-pz0-f61.google.com (HELO mail-pz0-f61.google.com) (209.85.210.61) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 02 Jun 2011 03:07:43 +0000 Received: by pzk4 with SMTP id 4so170884pzk.26 for ; Wed, 01 Jun 2011 20:07:42 -0700 (PDT) MIME-Version: 1.0 Received: by 10.142.195.16 with SMTP id s16mt73954wff.10.1306984062853; Wed, 01 Jun 2011 20:07:42 -0700 (PDT) Path: l2g2000prg.googlegroups.com!not-for-mail Newsgroups: comp.lang.c++ Date: Thu, 02 Jun 2011 03:07:00 -0000 Complaints-To: groups-abuse@google.com Injection-Info: l2g2000prg.googlegroups.com; posting-host=99.116.255.96; posting-account=aekHSAoAAADeChaoWK7DJgcBoN_eKvLi NNTP-Posting-Host: 99.116.255.96 References: <94ns1jF12lU13@mid.individual.net> <94ntlmF12lU14@mid.individual.net> User-Agent: G2/1.0 X-Google-Web-Client: true X-Google-Header-Order: HUALESNKRC X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.17) Gecko/20110422 Ubuntu/10.04 (lucid) Firefox/3.6.17,gzip(gfe) Message-ID: <49d055a9-79d3-4e35-b8c8-7101bbc845d0@l2g2000prg.googlegroups.com> Subject: Re: like to know why it is segmentation fault on simple throw-exception program From: eric Cc: gcc-help@gcc.gnu.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org X-SW-Source: 2011-06/txt/msg00027.txt.bz2 On Jun 1, 3:46=A0pm, Victor Bazarov wrote: > On 6/1/2011 6:44 PM, Ian Collins wrote: > > > > > On 06/ 2/11 10:34 AM, Victor Bazarov wrote: > >> On 6/1/2011 6:16 PM, Ian Collins wrote: > >>> On 06/ 2/11 10:01 AM, eric wrote: > >>>> Dear comp.lang.c++ reader or advced c++ programers: > >>>> =A0[...] > >>> Also using exception specifiers is generally regarded as bad practice. > > >> Really? > > >>> It will land you in all sorts of problems if something you call throws > >>> some other exception type. > > >> That can be too deep for the OP. The inquiry looked very much like a > >> homework (done by the OP, which is commendable), part of a C++ course, > >> in which they *might* learn later that an exception specification is > >> frowned upon by some c.l.c++ inhabitants. > > > There are some who don't frown upon them? > > I don't see them in production code (except the 'throw' with the > empty parens, which promises that nothing is thrown, as I understand > it), so I don't care one way or the other. > > V > -- > I do not respond to top-posted replies, please don't ask --------------------------------------------------------------- Dear Victor or advanced c++ program(especially on g++ camp): I follow many of your suggestion, ie change && to || in push then after it run ------------- terminate called after throwing an instance of 'char const*' Aborted ----------this is better than Segmentation fault, but still not expected------- the trouble is happen at call of throw and catch (receiveing) part it show somehting before throw, but it did not reponse any (or first) statement in catch block plz help,(its on gnu/gcc/g++ of linux), thanks a lot in advance, Eric