[Issue 9421] New: (Compiler internals) Change OutBuffer's interface

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Jan 29 00:31:04 PST 2013


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

           Summary: (Compiler internals) Change OutBuffer's interface
           Product: D
           Version: D1 & D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: yebblies at gmail.com


--- Comment #0 from yebblies <yebblies at gmail.com> 2013-01-29 19:31:03 EST ---
Using OutBuffer makes it easy to forget to zero-terminate strings and create
dangling pointers.  I'm think we should make OutBuffer a little less error
prone.

Changes:
- Get rid of toChars
- Add extractString which checks for a '\0' then takes ownership of the
internal buffer
- Add scopedString which checks for a '\0' then return a reference to the
internal buffer
- Add scopedData which returns a reference to the internal buffer

Benefit:
- Nobody will use toChars thinking that it copies/owns the data
- Harder to forget to zero-terminate strings
- Hopefully less casting

-- 
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