In my endless transition to GNU gcc I'm having troubles with the new operator when try to use in the non-throw versio (I.E. the old style of controlling the fault). For example, when I try
include <new>
char* cptr = new (std::nothrow) char[10];
I got some error (whose not appear in BC++): ..."std::nothrow' is not a type"
Could someone point out where is my error?
By the way I'm using Dev-C++ 4.9.9.2
Thanks in advance
Newbie
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Although the code was absolutely without mistakes, your observation make me watch in that direction. Possibly I reused an previous C project to my tests, so although the file name where main.cpp, there where a flag IsCpp=0 instead IsCpp=1 in the .dev file. So, make was thinking that is was a C projec (I believe).
After the appropriate changes, the source compiles seamless.
Greetings.
Newbie.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi all:
In my endless transition to GNU gcc I'm having troubles with the new operator when try to use in the non-throw versio (I.E. the old style of controlling the fault). For example, when I try
include <new>
char* cptr = new (std::nothrow) char[10];
I got some error (whose not appear in BC++): ..."std::nothrow' is not a type"
Could someone point out where is my error?
By the way I'm using Dev-C++ 4.9.9.2
Thanks in advance
Newbie
O_o
There is nothing wrong with the posted line. I'm guessing you misspelled it in your code and transposed it in the post.
If that isn't the problem, copy and paste the big three. Do not transpose anything.
Soma
include <new>
int main(int argc, char ** argv)
{
char * p(new (std::nothrow) char[10]);
return(0);
}
Soma:
Thank you very much for your's help.
Although the code was absolutely without mistakes, your observation make me watch in that direction. Possibly I reused an previous C project to my tests, so although the file name where main.cpp, there where a flag IsCpp=0 instead IsCpp=1 in the .dev file. So, make was thinking that is was a C projec (I believe).
After the appropriate changes, the source compiles seamless.
Greetings.
Newbie.
Replace #include<new> with #include<iostream>.
Anyway, what is <new>? </new></iostream></new>
If you don't know, look it up before posting in ignorance. <new> is the
standard library header that defines std::nothrow.