From 4bd3d7e17ccb94b477d77436c9ed4548dd47911b Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Mon, 23 Mar 2009 04:52:53 +0000 Subject: [PATCH] VC++ 6.0 is not future work :) Do not recommend llvm::OStream anymore. Use raw_ostream or MemoryBuffer. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67504 91177308-0d34-0410-b5e6-96231b3b80d8 --- docs/CodingStandards.html | 69 +++------------------------------------ 1 file changed, 5 insertions(+), 64 deletions(-) diff --git a/docs/CodingStandards.html b/docs/CodingStandards.html index 1c9c1451755..0aab5c7b671 100644 --- a/docs/CodingStandards.html +++ b/docs/CodingStandards.html @@ -379,9 +379,8 @@ code, isolate it behind a well defined (and well documented) interface.

In practice, this means that you shouldn't assume much about the host compiler, including its support for "high tech" features like partial -specialization of templates. In fact, Visual C++ 6 could be an important target -for our work in the future, and we don't want to have to rewrite all of our code -to support it.

+specialization of templates. If these features are used, they should only be +an implementation detail of a library which has a simple exposed API.

@@ -526,67 +525,9 @@ library. There are two problems with this:

example) is allowed normally, it is just <iostream> that is causing problems.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Old WayNew Way
#include <iostream>
#include "llvm/Support/Streams.h"
DEBUG(std::cerr << ...);
-DEBUG(dump(std::cerr));
DOUT << ...;
-DEBUG(dump(DOUT));
std::cerr << "Hello world\n";
llvm::cerr << "Hello world\n";
std::cout << "Hello world\n";
llvm::cout << "Hello world\n";
std::cin >> Var;
llvm::cin >> Var;
std::ostream
llvm::OStream
std::istream
llvm::IStream
std::stringstream
llvm::StringStream
void print(std::ostream &Out);
-// ...
-print(std::cerr);
void print(llvm::OStream Out);1
-// ...
-print(llvm::cerr);
-
- -

Notes:

- -
-
    -
  1. llvm::OStream is a light-weight class so it - should never be passed by reference. This is important because in some - configurations, DOUT is an rvalue.
  2. -
-
+

The preferred replacement for stream functionality is the +raw_ostream class (for writing to output streams of various sorts) and +the MemoryBuffer API (for reading in files).

-- 2.34.1