From: Sven R. <rei...@ma...> - 2003-04-23 15:50:56
|
On Wed, 23 Apr 2003, Baptiste Lepilleur wrote: > > You're fast, I intented to write the mail this morning with a fresher head > ;-) I finally sbuscribed to the CVS mailing list :) > > By the way Sven, would you mind changing your editor settings from 'insert > tabs' to 'insert spaces' ? This would allow the code to be correctly > indented without regards to the editor settings. Hmmm... usually emacs inserts spaces. The only issue that I can think of is that when adding a statement, it uses the indentation space found in the previous statement. Where there tabs in all the code I added? I still need to remember to change the indentation space; right now emacs uses 2 spaces, where as in most of the code, 3 spaces are used, if I'm not mistaken. > > Don't ever do that. stdafx.h is an optimization only (I made some benchmark > a while ago with an old project and it saved about 5 seconds out of 35 > seconds for a complete build). The project should compile correctly fine if > stdafx.h is a blank file. Only widely used STL headers should go there. If > it does not compile on Unix, then it is a bug, and the missing STL include > should be added. Ok. BTW, your timing is impressive. gcc is way slower. Just tested, it uses 7 min for a complete rebuild (with tests, but without eclipse and VC plugins) :( But then, I have a slow computer. > > I figured it was something like that. I usually deal with this by either > configuring the compiler to break when a C++ exception is thrown, or by > placing a break point in the exception constructor. Is it not possible to do > that for you ? I'll think about that. > > If so, we may want to introduce a asssertion facilities (throw exception in > standard mode, break in 'advanced debug mode'). Is it correct that during normal execution of the code, no exceptions are thrown? Then I could just switch off support for exceptions. However, I think that at least CppUnit relies heavily on them. > > Check out the boost documentation in boost/libs/smart_ptr. You'll find the > few functions to deal with smart-pointer (cast...), as well as a new page > explaining the many use of shared_ptr. > > > The other point is that I understand the use of shared pointers if we have > > several pointers to the same object, and it is not clear which one will > > survive longer. IMO this is not the case when dealing with a visitor; the > > host calls a method of the visitor in its accept method, and the host > > certainly exists during the execution of the method. Thus an ordinary > > pointer is sufficient in this case; since it is simpler to manage (and > > more efficient) it should be preferred. > > Please let me know if I'm missing a good reason why to use shared pointers > > here. > > Yes there is. This allow you to collect code element while visiting and > reuse them when transforming the code. Main use though would probably be to > move statements and declarations around. I still need to get used to the idea of a visitor modifying the structure (not only the content) of the object it is visiting. > > doubley[3]; > > > > We have to find some policy to sensibly add a space in such situations. I > > still haven't figured it out, but I'll keep thinking. > > My thougth as do have something like insert a space if the primary type > (+secondary ?) ends with a letter, > or ] (probably slightly more complexes > because of secondary type prefix). When stumbling on weird case like this, I > tried to apply test first design (write the test and get them to work). I have added a test for this. > > > > Do we have any class that does this, or should I derive my own document > > from LineBasedTextDocument? > > Yes, that what you need to do (and what is done in by the VC++ add-in). Be > aware that there is still a known bug to deal with: tabulations are not > converted to the correct column number. Ok, that's what I'll do. Later, Sven. -- Sven Reichard Dept. of Math. Sci. University of Delaware rei...@ma... |