你遇到过的源代码中最好的注释是什么?


当前回答

int MyFunction()
{
    // There once was a man named Dave
    int Result = 0;

    // Whose code just wouldn't behave
    MyObject *Ptr = new MyObject();

    // He left to go to a meetin'
    Result = Ptr->DoSomething();

    // And left his memory a leakin'
    return Result;
}

c++怎么样

其他回答

// Iced odnako
bool Iced{get;set;}

/*现在,让所有这些看 半得体的弱智步 哥哥 浏览器家族中的一员,互联网 该死的探险家*/

在XSLT文件的头文件中:

DON'T TOUCH THIS SCRIPT -> XSLT is like arcane, black magic

我刚刚在。net的自定义Linq提供程序中找到了这个:

//select is a royal pain in the ass where 
//the parameter passed to CreateQuery isn't actually the one that goes in the call
//requiring this workaround.  Not sure how straight Linq to Objects does it.

还有这个

//expressions have to be compiled in order to work with the method call on 
//straight Enumerable somehow, LINQ to objects itself magically does this.  
//Reflector shows a mess, so I (Aaron) invented my own way.  God love unit tests!

我刚刚也找到了这个…一切都会变得更好

  //ok, this is a hairy, dirty, and nasty piece of code
  //the alternatives are substantially worse than this though
  //i.e. when you do your own provider, LINQ assumes that
  //you are going to implement your own expression tree visitor and
  //do it all yourself.  Frankly, I still have xmas shopping to do
  //and I really don't want us to be foobared when we get
  //even more extension methods added to LINQ
  //therefore, we are pulling execute based on taking the calling the 
  //standard execute on enumerable, but using our own class
  //
  //optimization can occur from here on an as needed basis, that is
  //check for the value of mex.Method.Name, and write a handler for
  //that method
  //
  //also, it may not be a bad idea to rather than do this reflection 
  //each and every time somehow cache the reflected methodinfos and do 
  //lookups that way that said, we need a complete red/green/refactor 
  //cycle here before I am touching that one

还有这个

//Compile that mutherf-ker, invoke it, and get the resulting hash
// StupidCompilerDontInline(SCDI), in the test project where
// allcode was in a single cpp the compiler had inlined nearly
// everything which lead to nice stackoverflow.
// To prevent this the metods are made virtual
#define SCDI virtual