www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 3852] New: Default struct constructors needed


           Summary: Default struct constructors needed
           Product: D
           Version: future
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: samukha voliacable.com

--- Comment #0 from Max Samukha <samukha voliacable.com> 2010-02-25 02:19:18
PST ---
Qt has quite a lot of types with pass-by-value semantics. For example, all COW
types are value types

Currently, QtD implements such types as classes, which implies an excessive
heap allocation happens every time a value of such a type is passed to D.

We are trying to solve this problem by wrapping Qt's value types in D structs.
Those structs must always be properly initialized via a call to Qt. It would be
incorrect to just declare a variable like this:

QString s;

We would have to force the programmer to explicitly run a function emulating
the default constructor (e.g. opCall), or expect him to suffer badly when he
forgets to do so.

Possible solutions:

1. Implement proper default constructors for structs.
2. Make it possible to forbid the use of uninitialized structs.

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