[Issue 5997] Static arrays with 0 length accepted by compiler

2015-06-09 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=5997

Andrei Alexandrescu and...@erdani.com changed:

   What|Removed |Added

Version|unspecified |D2

--


[Issue 5997] Static arrays with 0 length accepted by compiler

2011-05-14 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5997


Vladimir thecybersha...@gmail.com changed:

   What|Removed |Added

 CC||thecybersha...@gmail.com


--- Comment #1 from Vladimir thecybersha...@gmail.com 2011-05-13 23:39:57 PDT 
---
(In reply to comment #0)
 Is there a use case for 0-length static arrays?

I believe they can be used as a value type in an associative array to create a
set.

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


[Issue 5997] Static arrays with 0 length accepted by compiler

2011-05-14 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5997


bearophile_h...@eml.cc changed:

   What|Removed |Added

 CC||bearophile_h...@eml.cc


--- Comment #2 from bearophile_h...@eml.cc 2011-05-14 02:57:56 PDT ---
One use case are variable-length structs:

struct MyArray(T) {
  size_t len;
  T data[0];

  // access methods here, that use data.offsetof
}

You create such array with a C malloc or GC malloc.

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


[Issue 5997] Static arrays with 0 length accepted by compiler

2011-05-14 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5997


Andrej Mitrovic andrej.mitrov...@gmail.com changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution||INVALID


--- Comment #3 from Andrej Mitrovic andrej.mitrov...@gmail.com 2011-05-14 
13:21:39 PDT ---
(In reply to comment #1)
 (In reply to comment #0)
  Is there a use case for 0-length static arrays?
 
 I believe they can be used as a value type in an associative array to create a
 set.

Ah, you're right. I even forgot about opening this topic which mentioned this
trick:
http://www.digitalmars.com/d/archives/digitalmars/D/A_case_for_valueless_AA_s_133165.html

I'm closing this down.

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