Is there problem to declare an empty char array?

Pages: 1... 345
If "abc" is taken care of compile-time then why could it represent two addresses?

Are you saying how "abc" is handled is not defined? By the way where do you read about C++ standard and upcoming drafts?
Last edited on
If "abc" is taken care of compile-time then why could it represent two addresses?

Because (assuming Peter87 is correct) the standard says it doesn't have to. Any C++ implementation would be allowed to have that bit of code print 2 different addresses.

Now, I can't think of any reason why a C++ implementation would do that, which I would guess is why Peter87 said:

Peter87 wrote:
This is not guaranteed to print the same address twice, even though it most likely will.

But if the authors of a C++ implementation had a reason to do so, the standard would allow them to.

By the way where do you read about C++ standard and upcoming drafts?

http://lmgtfy.com/?q=C%2B%2B+standard

http://lmgtfy.com/?q=C%2B%2B+standard+upcoming+drafts
One reason I can think of is if you use duplicate string literals in separate translation units (e.g. if the literal is behind a macro in a header). The linker may not be smart enough to pool them.
Topic archived. No new replies allowed.
Pages: 1... 345