Actually C++ has closures, delegates, anonymous types, lazy evaluation and (yield). - delegates, lazy evaluation exist before C# has it through template in boost.signal, boost.phoenix among others. - closures, anonymous types are on C++0x and already shipped with VC++ 2010 an gcc 4.5+ - yield? here you are
rockonedge
Posts
-
Really frustrated when moving from C# to C++ -
Moving from C# to C++While other's most likely mean Stroustrup by this book http://www.amazon.com/C-Programming-Language-Special-3rd/dp/0201700735/ref=sr_1_3?ie=UTF8&s=books&qid=1247715368&sr=8-3[^] His new book http://www.amazon.com/Programming-Principles-Practice-Using-C/dp/0321543726/ref=sr_1_1?ie=UTF8&s=books&qid=1247715368&sr=8-1[^] is very well written and much less academical.
-
deterministic cleanup in C++/CLII tried the following code
StreamWriter^ f = gcnew StreamWriter(L"d:\\listfile.txt"); f->Write(L"begin");
expecting a file containing the string "begin" to be created. To my surprise, only an empty listfile.txt was created. "begin" was not written. after a few trials, I realized I must explicitly callf->Close()
to get "begin" to be written. is it true that one of the advantages of C++/CLI over c# is that when an object goes out of scope, there is something called deterministic cleanup to close the object, or am I miseducated? For std::fstream, I surely don't have to call close() explicitly. -
What is your favorite feature of Firefox?ctr + F, with instant match
-
Best C++ Book to get?For me, Bruce Eckel's "Think in C++" was the first light to understand C++. Josuttis M. Nicolai's "The C++ Standard Library : A Tutorial and Reference" was the first hand book to code against. Bjarne's book was the last judgement to undstand any doubts - I have an e-book version to search for the answers I wanted.
-
what's theClass for in BEGIN_MSG_MAP(theClass)?I find that in ATL, the macro BEGIN_MSG_MAP(theClass) is defined this way:
#define BEGIN_MSG_MAP(theClass) \ public: \ BOOL ProcessWindowMessage(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT& lResult, DWORD dwMsgMapID = 0) \ { \ BOOL bHandled = TRUE; \ hWnd; \ uMsg; \ wParam; \ lParam; \ lResult; \ bHandled; \ switch(dwMsgMapID) \ { \ case 0:
Interestingly,theClass
is not used anywhere, then what's the use oftheClass
here? Thanks. -
How to make progress in English?True. To save the burden carrying a TV set wherever you go, listen to China Radio International(CRI).It's available at least in Beijing and Shanghai with an FM tuner. and come here frequently.:-D
-
Does C++/CLI really has better performace than C#ABuenger wrote:
It doesn't matter whether or not you have any native code in your source, the compiler still produces a mixed imaged. Therefore you always start with some overhead if you don't set the compiler switch to /clr:pure (or /clr:safe). C# always creates managed assemblies, C++/CLI creates mixed ones by default. Therefore you have a different entry point and start up code.
Thanks, the default setting is /clr:pure, however you are right if switched to /clr:safe, it shrinks to 7k now.
-
Does C++/CLI really has better performace than C#Nishant Sivakumar wrote:
the C# compiler produces an MSIL image, while the C++ compiler produces a mixed mode image (capable of directly using native types).
Thanks, learned something new.
Nishant Sivakumar wrote:
change the C++ compiler mode to /clr:safe (this is same as what you get with C#).
Tried that, it's different in the other way now, the file size is only 7k!
-
Does C++/CLI really has better performace than C#Well, it's a completely CLR app. no native code. the title is wrong, it's not about performance. it's about what extra gear C++ carries by default than a C# in a basic winform app.
-
Does C++/CLI really has better performace than C#That's fair. In fact, I did not meant to light up a war. That's not language comparison either. It's totally wrong. My initial curiosity is since 1)these wizard-generated apps do the same thing(even the code is almost the same) and 2)both were compiled to CLR, they are supposed to be approx. the same size. But they are not, it seems the c++ version links something more, and what are they? I chose the wrong title:sigh:
-
Does C++/CLI really has better performace than C#Perfect.
-
Does C++/CLI really has better performace than C#I did a small test: create a default project using VS2005 wizard respectively in C++/CLI and C#, which displays a dummy winform. No code added, no change made. Compile and run both of them. Here's the observation: File size: cppclr.exe 35k(release) / 38k(debug) csharp.exe 16k(release) / 16k(debug) memory usage: cppclr.exe 11,164k(release) / 17,500k(debug) csharp.exe 10,588k(release) / 9,136k(debug) What happened there?
-
Anybody Here Used . . .no real bench mark. But I once ran the same application written by myself to parse XML and do some file I/Os. It's slightly faster on my dual core laptop (1.8G) than on my desktop single core Dell GX520(3GH). -- modified at 4:13 Friday 18th August, 2006
-
Anybody Here Used . . .I do. I have a Dell Latitude D620 laptop.
-
TinyXMLThe only drawback is that it does not support UNICODE.:sigh: