STL and "function try blocks"



Hallo

the following code does not compile (VC 7.1):

#include <vector>

int testTry() try{
std::vector<int> *x = new std::vector<int>;
delete x;
return 0;
}catch (...) {
return 0;
}

int main(){
return 0;
}


d:\tmp\trytst\trytst\trytst.cpp(11) : warning C4091: '' : ignored on left of
'int' when no variable is declared
d:\tmp\trytst\trytst\trytst.cpp(11) : error C2143: syntax error : missing
';' before 'inline function header'

Does any one understand why it compiles if I delete the "delete x;"
statement?

thanks
Babak


.



Relevant Pages

  • Re: GCC difference in size of long int on Suse SLES9 / Suse Professional 10.0
    ... The kernel uses printf() with 'long int', ... I can't compile 'on-the-fly'. ... clashing with the hardware and any libs that you interact with. ... platform types build up their own int types. ...
    (comp.os.linux.development.apps)
  • Re: Im a C++ programmer, and Relfs X.CPP is good.
    ... >> and it doesn't compile either. ... home.cpp:93: implicit declaration of function `int fclose' ... You cannot change to your home directory through an external ...
    (comp.lang.lisp)
  • Re: Im a C++ programmer, and Relfs X.CPP is good.
    ... >> and it doesn't compile either. ... home.cpp:93: implicit declaration of function `int fclose' ... You cannot change to your home directory through an external ...
    (comp.unix.programmer)
  • Re: new order doubt
    ... Warning test2.c: 8 no type specified. ... Defaulting to int ... Tests probably come in several different types: this should compile ... Even Microsoft has problems with this obscure rules. ...
    (comp.lang.c)
  • Re: non-static context
    ... public MyStatic(int length, int width) { ... Within the MyStatic constructor method, a local variable named area is ... This version of class MyStatic won't compile. ...
    (comp.lang.java.help)