[llvm-commits] CVS: llvm/www/docs/ProgrammersManual.html
Christopher Lattner
lattner at cs.uiuc.edu
Fri Sep 6 17:52:01 PDT 2002
Changes in directory llvm/www/docs:
ProgrammersManual.html updated: 1.8 -> 1.9
---
Log message:
* Fix a couple more <>&'s
* Correct an extremely minor technical point about a deprecated interface.
---
Diffs of the changes:
Index: llvm/www/docs/ProgrammersManual.html
diff -u llvm/www/docs/ProgrammersManual.html:1.8 llvm/www/docs/ProgrammersManual.html:1.9
--- llvm/www/docs/ProgrammersManual.html:1.8 Fri Sep 6 17:12:58 2002
+++ llvm/www/docs/ProgrammersManual.html Fri Sep 6 17:51:10 2002
@@ -251,22 +251,25 @@
<pre>
// blk is a pointer to a BasicBlock instance
- for(BasicBlock::iterator i = blk->begin(), e = blk->end(); i != e; ++i) {
- // the next statement works since operator<<(ostream&,...)
- // is overloaded for Instruction&
+ for(BasicBlock::iterator i = blk->begin(), e = blk->end(); i != e; ++i) {
+ // the next statement works since operator<<(ostream&,...)
+ // is overloaded for Instruction&
- cerr << *i << endl;
+ cerr << *i << endl;
}
</pre>
However, this isn't really the best way to print out the contents of a
<tt>BasicBlock</tt>! Since the ostream operators are overloaded for
virtually anything you'll care about, you could have just invoked the
-print routine on the basic block itself: <tt>cerr << blk <<
-endl;</tt>. You might expect this to print out the pointer value of
-blk, but operator<< is overloaded for BasicBlock* as well: if you
-really want to print the pointer value explicitly, you'll have to
-cast.
+print routine on the basic block itself: <tt>cerr << *blk <<
+"\n";</tt>.<p>
+
+Note that currently operator<< is implemented for <tt>Value*</tt>, so it
+will print out the contents of the pointer, instead of
+the pointer value you might expect. This is a deprecated interface that will
+be removed in the future, so it's best not to depend on it. To print out the
+pointer value for now, you must cast to <tt>void*</tt>.<p>
<!-- _______________________________________________________________________ -->
</ul><h4><a name="iterate_convert"><hr size=0>Turning an iterator into a class
More information about the llvm-commits
mailing list