Object creation on stack in loop

have a piece of code
for (int i = 0; i<5; i++)
  CMyStackObject sobj;

Does standard guarantees that instances of sobj will be different for different i?
they'll be different. each one will 'die' when it goes out of scope at the end of the for loop.
Last edited on
Yes, the instances will be different. But it's likely that the instances will be instantiated at the same location in memory (i.e. they have the same value for the this pointer).
OK, thanks. No matter, of course, whether pointer will be on very same place or another. For me critical is to have destructor to be called.

sobj is actually that well known helper object for RAII technology.
Topic archived. No new replies allowed.