digitalmars.D.bugs - [Issue 953] New: Multiple C style declarations of same type cannot be in one statement
- d-bugmail puremagic.com (19/19) Feb 12 2007 http://d.puremagic.com/issues/show_bug.cgi?id=953
- d-bugmail puremagic.com (11/11) Mar 20 2007 http://d.puremagic.com/issues/show_bug.cgi?id=953
- d-bugmail puremagic.com (13/13) Mar 20 2007 http://d.puremagic.com/issues/show_bug.cgi?id=953
- d-bugmail puremagic.com (33/33) Aug 10 2009 http://d.puremagic.com/issues/show_bug.cgi?id=953
- d-bugmail puremagic.com (16/16) Jan 20 2013 http://d.puremagic.com/issues/show_bug.cgi?id=953
- d-bugmail puremagic.com (7/7) Jan 20 2013 http://d.puremagic.com/issues/show_bug.cgi?id=953
- d-bugmail puremagic.com (7/9) Jan 20 2013 http://d.puremagic.com/issues/show_bug.cgi?id=953
- d-bugmail puremagic.com (32/32) Jul 03 2013 http://d.puremagic.com/issues/show_bug.cgi?id=953
http://d.puremagic.com/issues/show_bug.cgi?id=953 Summary: Multiple C style declarations of same type cannot be in one statement Product: D Version: 1.005 Platform: PC OS/Version: Windows Status: NEW Keywords: rejects-valid Severity: minor Priority: P3 Component: DMD AssignedTo: bugzilla digitalmars.com ReportedBy: deewiant gmail.com int foo[2], bar[2]; The above fails with the error message "multiple declarations must have the same type, not int[2] and int[2]" which makes no sense. int[2] is the same type as int[2]. --
Feb 12 2007
http://d.puremagic.com/issues/show_bug.cgi?id=953 bugzilla digitalmars.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |INVALID This is by design. The declaration should be: int[2] foo, bar; More than one C-style declaration in the same line is not allowed. --
Mar 20 2007
http://d.puremagic.com/issues/show_bug.cgi?id=953 deewiant gmail.com changed: What |Removed |Added ---------------------------------------------------------------------------- Severity|minor |trivial Status|RESOLVED |REOPENED Keywords|rejects-valid |diagnostic Priority|P3 |P4 Resolution|INVALID | Then it's a problem with the error message, which should say that, instead of its current nonsense. --
Mar 20 2007
http://d.puremagic.com/issues/show_bug.cgi?id=953 Witold Baryluk <baryluk smp.if.uj.edu.pl> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |baryluk smp.if.uj.edu.pl 05:10:34 PDT --- Hi, i just tried in DMD 1.043 int a[8], c[8]; and given me this nonsensical error. I know this is redudant, but is there to allow C style declarations. I just switch many times from C to D, and sometimes forgot where am I. In declarations.html we read: "In a declaration declaring multiple symbols, all the declarations must be of the same type: int x,y; // x and y are ints int* x,y; // x and y are pointers to ints int x,*y; // error, multiple types int[] x,y; // x and y are arrays of ints int x[],y; // error, multiple types " I was all my life (actually life when i use D, so about 3 years) thinking this means, that: int[8] a,b,c; is equivalent of int a[8], b[8], c[8]; how about adding to spec example this entries: int[2] x,y; // x and y are static arrays of ints int x[2],y; // error, multiple types int x[2],y[2]; // error, multiple types int x[2],y[3]; // error, multiple types -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Aug 10 2009
http://d.puremagic.com/issues/show_bug.cgi?id=953 Andrej Mitrovic <andrej.mitrovich gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Priority|P4 |P2 CC| |andrej.mitrovich gmail.com Platform|x86 |All Version|1.005 |D1 & D2 AssignedTo|bugzilla digitalmars.com |nobody puremagic.com OS/Version|Windows |All Severity|trivial |normal 11:37:50 PST --- This affects both D1 and D2. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 20 2013
http://d.puremagic.com/issues/show_bug.cgi?id=953 11:45:33 PST --- This would be more simple to implement if we simply destroyed C-style array syntax. I don't know why we're waiting so long to get rid of them. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 20 2013
http://d.puremagic.com/issues/show_bug.cgi?id=953 11:46:05 PST ---This would be more simple to implement if we simply destroyed C-style array syntax.Read that as: C-style declarations, because it also affects pointers. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 20 2013
http://d.puremagic.com/issues/show_bug.cgi?id=953 bearophile_hugs eml.cc changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bearophile_hugs eml.cc 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: -------
Jul 03 2013