delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/09/07/18:25:52

From: Laurence Withers <lwithers AT lwithers DOT demon DOT co DOT uk>
Newsgroups: comp.os.msdos.djgpp
Subject: Exception specifications and pointers?
Date: Tue, 7 Sep 1999 13:53:16 +0100
Message-ID: <kKTUeIA8qQ13EA4Y@lwithers.demon.co.uk>
NNTP-Posting-Host: lwithers.demon.co.uk
X-NNTP-Posting-Host: lwithers.demon.co.uk:194.222.80.1
X-Trace: news.demon.co.uk 936740166 nnrp-01:28960 NO-IDENT lwithers.demon.co.uk:194.222.80.1
X-Complaints-To: abuse AT demon DOT net
MIME-Version: 1.0
X-Newsreader: Turnpike (32) Version 4.01 <WCcCG$mmNL32sYSf46vBeC80CR>
Lines: 43
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Hi,

(not really sure where to ask this, so I'll ask here)

In "The C++ Programming Language, 3rd Edition", it is stated that you
can use pointers with exception specifications. However, gcc-2.95.1
doesn't like this. For instance:

- cut here -------------------------------------------------------------
#include <iostream>

void myFunction(int) throw();

void (*f)(int) = myFunction;
void (*g)(int) throw() = myFunction;

int main()
{
    f(0);
    g(1);
    return 0;
}

void myFunction(int I) throw()
{
    cout << I << endl;
}
- cut here -------------------------------------------------------------

This should compile without any warnings or errors, and should never die
from an uncaught exception. However, when I try to compile:

  gxx -o test.exe test.cpp
  test.cpp:6: invalid exception specifications

So, my question: is this a feature that hasn't been implemented in GCC,
something that is not correct C++, or am I just doing something wrong
(like I usually am...).

Well, thanks for your help + time, and bye for now,
-- 
Laurence Withers, lwithers AT lwithers DOT demon DOT co DOT uk
                http://www.lwithers.demon.co.uk/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019