Bug #40549 Use of non-standard C++ syntax should be removed from the code
Submitted: 6 Nov 2008 12:54 Modified: 11 Nov 2008 10:56
Reporter: Ole John Aske Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Cluster: Cluster (NDB) storage engine Severity:S3 (Non-critical)
Version:5.1.29-ndb-6.4.0 OS:Any
Assigned to: Jonas Oreland CPU Architecture:Any

[6 Nov 2008 12:54] Ole John Aske
Description:
'Zero length array-' and 'flexible array-' size has been used in the following struct definitions:

struct DbinfoScanReq
{
  ......
  Uint32 cursor[0];   <<<<<< Non-Standard, Require '-feature=zla' to compile on SunStudio
};

struct ndbinfo_table {
  NDBINFO_TABLE_MEMBERS
  struct ndbinfo_column col[];  <<<< No way to compile with SunStudio, change to [0] will partly fix it, though requiring 'zla'
};

These are nonstandard C++ extensions which currently breaks the 'Sol10' pushbuild2. Zero length array size may be accepted by SunStudio by adding '-feature=zla', though I strongly believe we should avoid usage of nonstandard C++ extension to provide maximum portability.

How to repeat:
Read the build logs from pushbuild2, Sol10
[6 Nov 2008 16:34] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/58052

2674 Magnus Svensson	2008-11-06
      Bug#40549 Use of non-standard C++ syntax should be removed from the code
       - Fix for 6.2
[6 Nov 2008 16:52] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/58066

2733 Magnus Svensson	2008-11-06
      Bug#40549 Use of non-standard C++ syntax should be removed from the code
       - Fix for 6.3
[6 Nov 2008 17:17] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/58073

3049 Magnus Svensson	2008-11-06
      Bug#40549  Use of non-standard C++ syntax should be removed from the code
       - Fix for 6.4(expect ndbinfo)
[6 Nov 2008 17:26] Bugs System
Pushed into 5.1.29-ndb-6.2.17  (revid:msvensson@mysql.com-20081106163402-xdj544z8nm8r9g08) (version source revid:msvensson@mysql.com-20081106163505-fydpp10qhh0c4rwa) (pib:5)
[6 Nov 2008 17:28] Bugs System
Pushed into 5.1.29-ndb-6.3.19  (revid:msvensson@mysql.com-20081106165150-8adxhph70n21qyqq) (version source revid:msvensson@mysql.com-20081106165150-8adxhph70n21qyqq) (pib:5)
[6 Nov 2008 17:43] Bugs System
Pushed into 5.1.29-ndb-6.4.0  (revid:msvensson@mysql.com-20081106171712-ml12otlq9jy6hp65) (version source revid:msvensson@mysql.com-20081106171712-ml12otlq9jy6hp65) (pib:5)
[8 Nov 2008 18:55] Ole John Aske
The draft if the next C++ standard (C++0x) is available at:

http://www.research.att.com/~bs/SC22-N-4411.pdf

About array declaration it says:

8.3.4 Arrays [dcl.array]
1 In a declaration T D where D has the form
D1 [ constant-expressionopt ] attribute-specifieropt
and the type of the identifier in the declaration T D1 is “derived-declarator-type-list T”, then the type of the
identifier of D is an array type; if the type of the identifier of D contains the auto type-specifier, the program
is ill-formed. T is called the array element type; this type shall not be a reference type, the (possibly cvqualified)
type void, a function type or an abstract class type. If the constant-expression (5.19) is present,
it shall be an integral constant expression and its value shall be greater than zero.

-> No zero length arrays expected in the next C++ standard either.
[11 Nov 2008 10:56] Jonas Oreland
fixed
[12 Dec 2008 23:25] Bugs System
Pushed into 6.0.9-alpha  (revid:msvensson@mysql.com-20081106163402-xdj544z8nm8r9g08) (version source revid:tomas.ulin@sun.com-20081209185954-9svcixh2p5hsfi6w) (pib:5)