Visual C++ 2008 TR1 Beta: array::max_size() returns incorrect value - by StephenDoyle

Status : 

  Fixed<br /><br />
		This item has been fixed in the current or upcoming version of this product.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.

Sign in
to vote
ID 333152 Comments
Status Closed Workarounds
Type Bug Repros 0
Opened 3/15/2008 9:20:19 AM
Access Restriction Public


In the Visual Studio 2008 Feature Release Beta, the C++ TR1 array container returns an incorrect value from max_size(). According to the specification it should be the size of the array since the size if fixed - i.e. for an array<T, N> where N is the size of the array, max_size() should return N. Instead it returns: 

	size_type max_size() const
		{	// return maximum possible length of sequence
		size_type _Count = (size_type)(-1) / sizeof (_Ty);

		return (0 < _Count ? _Count : 1);
Sign in to post a comment.
Posted by Microsoft on 4/1/2008 at 2:21 PM

Thanks for reporting this bug. It was fixed in November 2007, shortly after the Feature Pack Beta was branched, and the fix will be present in the final Feature Pack (to be released very, very soon).

If you have any further questions, feel free to E-mail me at .

Stephan T. Lavavej
Visual C++ Libraries Developer
Posted by Microsoft on 3/15/2008 at 11:47 PM
Thanks for your feedback. We are escalating this issue to the appropriate group within the Visual Studio Product Team for triage and resolution. These specialized experts will follow-up with your issue.

Thank you,
Visual Studio Product Team