Watch, Follow, &
Connect with Us

Please visit our new home

Public Report
Report From: C++BuilderX/RTL    [ Add a report in this area ]  
Report #:  10883   Status: Closed
Allocation of an empty array fails
Project:  C++BuilderX/BC++ 2005 Build #:
Version:    1.5 Submitted By:   Thomas Neumann
Report Type:  Basic functionality failure Date Reported:  2/10/2005 11:55:00 PM
Severity:    Serious / Highly visible problem Last Updated: 11/18/2005 4:49:20 PM
Platform:    All versions Internal Tracking #:  
Resolution: Cannot Reproduce (Resolution Comments) Resolved in Build: : 10.0.2142.8366
Duplicate of:  None
Voting and Rating
Overall Rating: (2 Total Ratings)
5.00 out of 5
Total Votes: 2
Calling "new char[0]" fails with a bad_alloc exception (see Steps for a simple example). This is wrong, allocating an empty array is valid.
Borland C++ 2005 Architect, bcc32 version 5.7.
Steps to Reproduce:
- foo.cpp:
#include <stdio.h>
int main() {
   try {
      new char[0];
   } catch (...) {

- bcc32 foo.cpp
- foo
- prints: "error", should print: "ok"


Server Response from: ETNACODE01