www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 2337] New: Can't set .length property in CTF.

reply d-bugmail puremagic.com writes:

           Summary: Can't set .length property in CTF.
           Product: D
           Version: 1.035
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: aziz.kerim gmail.com

The page for functions says that some "properties can be executed at compile
time", and it lists .length as one of those properties. Unfortunately it can
only be accessed by reading it, but assigning a value to it is not possible.

For example:

char[] ctf()
  // Create a table:
  char[][] table = [];
  // table.length = 250; // No simple enlargement.
  // Use ugly workaround:
  for (uint i; i < 250; i++)
    table ~= [];

  char[] code = "";
  // Create code from table.
  return code;

pragma(msg, ctf());

I think this shouldn't be too difficult to implement.

Sep 05 2008
parent d-bugmail puremagic.com writes:

yebblies <yebblies gmail.com> changed:

           What    |Removed                     |Added
             Status|NEW                         |RESOLVED
                 CC|                            |yebblies gmail.com
         Resolution|                            |FIXED

--- Comment #1 from yebblies <yebblies gmail.com> 2011-06-10 04:39:59 PDT ---
This works in dmd1.068 (and dmd2.053).

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