Thursday, July 9, 2009

How does visual studio C++ handle strings?

As below:


char* a = "abc"; char* b = "abc";


in debugger, a and b has same address.


How come?

How does visual studio C++ handle strings?
Because you're pointing to static text, and depending on what compiler setting you have, the optimizer notices the strings are the same and combines them.


No comments:

Post a Comment