11 Nov
2003
11 Nov
'03
1:35 p.m.
Matt S Trentini
You'll notice that I left the typedef in there. I can't find anything in the standard (or with google) about it being illegal in main, nor does my compiler emit any warnings. Can anyone shed some light on this?
There's nothing wrong with it. A typedef declaration is allowed wherever any other declaration is allowed, except in the condition of a 'for', 'if', 'switch' or 'while' statement.
And I've got to disagree with your friend about the correct ordering - the expected output is 3, 1, 2 (Remember that foo_ptr gets deleted first).
I don't see any requirement on the order of destruction of sequence elements, so I think it can be either 3, 1, 2 or 3, 2, 1.