Something is not as I expected
-
look at the code below:
int main(){
char *c=new char[10];
delete [10,05]c;
return 0;
}compile fine in visual studio 2008 and error in gcc.
I wish I could believe there is an after life.
-
look at the code below:
int main(){
char *c=new char[10];
delete [10,05]c;
return 0;
}compile fine in visual studio 2008 and error in gcc.
I wish I could believe there is an after life.
What happens during execution?
-
What happens during execution?
With Visual studio, work fine, with g++ compilation error
I wish I could believe there is an after life.
-
With Visual studio, work fine, with g++ compilation error
I wish I could believe there is an after life.
It runs successfully without errors then...:confused: Wow! :omg:
-
look at the code below:
int main(){
char *c=new char[10];
delete [10,05]c;
return 0;
}compile fine in visual studio 2008 and error in gcc.
I wish I could believe there is an after life.
This is a (rather pointless) MS extension to C++: Pointless extension[^] In your case, the comma operator will just throw away so the 10, so it becomes:
delete [05] c;
(Where 05 is an octal number) And in fact will be ignored, rendering the result exactly the same as:
delete [] c;
"Ours not to reason why".
"If you don't fail at least 90 percent of the time, you're not aiming high enough." Alan Kay.
-
This is a (rather pointless) MS extension to C++: Pointless extension[^] In your case, the comma operator will just throw away so the 10, so it becomes:
delete [05] c;
(Where 05 is an octal number) And in fact will be ignored, rendering the result exactly the same as:
delete [] c;
"Ours not to reason why".
"If you don't fail at least 90 percent of the time, you're not aiming high enough." Alan Kay.
Sh** I remember that ',' I school days, first curse in all year using Visual C++... beautiful monitors of 14" at 1024*768... We were calculating taxes for students based on Age and grade... There were some students that were paying always 0.00 ... we debug (we were students, still stupids at debuging)... noting show wrong... After like 5 hours... I went to play Ping Ping.. I returned, found my 2 teammates debugging.. then I notices and ask: Guys is that payment * 0.05 or payment * 0,05... I learned that day that VC++ when 0,05 does Payment * 0 * 05.. then everything become 0!!!!