digitalmars.D.bugs - [Issue 3341] New: Dummy stream
- d-bugmail puremagic.com (23/23) Sep 22 2009 http://d.puremagic.com/issues/show_bug.cgi?id=3341
- d-bugmail puremagic.com (57/57) Sep 22 2009 http://d.puremagic.com/issues/show_bug.cgi?id=3341
- d-bugmail puremagic.com (12/12) Sep 22 2009 http://d.puremagic.com/issues/show_bug.cgi?id=3341
- d-bugmail puremagic.com (11/13) Sep 22 2009 http://d.puremagic.com/issues/show_bug.cgi?id=3341
- d-bugmail puremagic.com (10/15) Sep 22 2009 http://d.puremagic.com/issues/show_bug.cgi?id=3341
- d-bugmail puremagic.com (8/8) Sep 25 2009 http://d.puremagic.com/issues/show_bug.cgi?id=3341
- d-bugmail puremagic.com (12/12) Jun 17 2010 http://d.puremagic.com/issues/show_bug.cgi?id=3341
http://d.puremagic.com/issues/show_bug.cgi?id=3341 Summary: Dummy stream Product: D Version: 2.032 Platform: Other OS/Version: Windows Status: NEW Severity: enhancement Priority: P2 Component: Phobos AssignedTo: nobody puremagic.com ReportedBy: dsimcha yahoo.com If std.stream is going to stay around much longer (not necessarily recommended), a simple but useful enhancement would be to include a dummy output stream, similar to /dev/null. This would be useful when a function or block of code expects an output stream, and you want to simply dispose of the output. If std.stream is going to be deprecated in the foreseeable future, then whatever replaces it should have this feature. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 22 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3341 David Simcha <dsimcha yahoo.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |patch This should do the job. I tested that it compiles, and it's pretty hard to have a logic error given that it's supposed to do nothing. Just to make it explicit, I hereby release the DummyStream class into the public domain, if it's even copyrightable. /**A dummy stream for disposing of output. Supports the interface of an * OutputStream, simply does nothing for any method call.*/ class DummyStream : OutputStream { this() {} void writeExact(const void* buffer, size_t size){} size_t write(const(ubyte)[] buffer) { return buffer.length; } void write(byte x) {} void write(ubyte x) {} void write(short x) {} void write(ushort x) {} void write(int x) {} void write(uint x) {} void write(long x) {} void write(ulong x) {} void write(float x) {} void write(double x) {} void write(real x) {} void write(ifloat x) {} void write(idouble x) {} void write(ireal x) {} void write(cfloat x) {} void write(cdouble x) {} void write(creal x) {} void write(char x) {} void write(wchar x) {} void write(dchar x) {} void write(char[] s) {} void write(const(wchar)[] s) {} void writeLine(const(char)[] s) {} void writeLineW(const(wchar)[] s) {} void writeString(const(char)[] s) {} void writeStringW(const(wchar)[] s) {} size_t vprintf(char[] format, va_list args) { return 0; } size_t printf(char[] format, ...) { return 0; } OutputStream writef(...) { return this;} OutputStream writefln(...) { return this; } OutputStream writefx(TypeInfo[] arguments, void* argptr, int newline = false) { return this; } void flush() {} void close() {} bool isOpen() { return true; } } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 22 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3341 Andrei Alexandrescu <andrei metalanguage.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED CC| |andrei metalanguage.com AssignedTo|nobody puremagic.com |andrei metalanguage.com 12:12:40 PDT --- Thanks! The patch pretty much shows the age of the stream design... -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 22 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3341 BCS <shro8822 vandals.uidaho.edu> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |shro8822 vandals.uidaho.edu ---size_t vprintf(char[] format, va_list args) { return 0; } size_t printf(char[] format, ...) { return 0; }I'd think this should return the same as the function in the other classes do. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 22 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3341I agree in principle, except that then you would have to do the whole formatting just to figure out what that number should be. This seems wasteful. I consider it to be a minor detail anyhow, since really, who the heck still uses vprintf and printf? -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------size_t vprintf(char[] format, va_list args) { return 0; } size_t printf(char[] format, ...) { return 0; }I'd think this should return the same as the function in the other classes do.
Sep 22 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3341 --- Hack. size_t vprintf(char[] format, va_list args) { return format.length; } size_t printf(char[] format, ...) { return format.length; } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 25 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3341 David Simcha <dsimcha yahoo.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |RESOLVED Resolution| |WONTFIX I'm resolving this as WONTFIX because we've decided std.stream is going the way of the dodo. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jun 17 2010