[Issue 953] Multiple C style declarations of same type cannot be in one statement

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Jul 3 10:17:40 PDT 2013


http://d.puremagic.com/issues/show_bug.cgi?id=953


bearophile_hugs at eml.cc changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bearophile_hugs at eml.cc


--- Comment #7 from bearophile_hugs at eml.cc 2013-07-03 10:17:37 PDT ---
So this code has different meanings in C and D:

void main() {
    int *a, b;
}


And to keep the D language simple this is disallowed:

int a[8], c[8];


Then what is this issue asking for?

In Issue 5807 I have suggested to disallow mixing C and D style of array in a
single declaration:

// array of 5 dynamic arrays of ints.
int[][5] c;
int[] c[5];
int c[5][];

Also because of some problems it causes with vector ops syntax:

void main() {
    int[] a1 = [1, 2, 3];
    int[] a2 = new int[3];
    a2[] = a1[];           // OK
    int[3] a3[] = a2[];    // line 5, Error
}


Beside disallowing the mix of C and D syntaxes in a single declaration, another
thing that may be good to do is to perpetually deprecate the C syntax (and do
not turn it into an error).

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list