Posts Tagged ‘c++’
Houston, we have a (performance) problem
Tuesday, December 15th, 2009Ouch. These last few days, I’ve been fixing a few lingering bugs in my STM system, and last night, I finally nailed them. Specifically, it is now possible to open variables within a transaction as read-only. An obvious optimization, right? At least that’s the idea. Less work is required by the STM system if we can trust that the variable isn’t modified by this transaction. (more…)
Using My STM Library
Monday, November 30th, 2009As promised yesterday, I’d like to show off a few bits of my STM library. Of course it’s far from done, and is still missing several key features, but the core library is in pretty good shape. So as they say on the internets, “my STM library, let me show you it” (more…)
Being functional in an imperative language
Saturday, October 3rd, 2009By now, I’ve read an awful lot of papers about STM systems, and certain trends are really starting to stand out, not so much in terms of the algorithms used or the clever schemes invented to make transactions appear atomic, but in how they interface with the actual language.
It has really underlined to me just how deeply entrenched most Java, C and C++ programmers are in the imperative mindset. (more…)
A .NET Developers Guide to C++ (part III)
Thursday, October 1st, 2009We’re nearing the end!
Part I focused on the very fundamentals of C and C++, making sure that you understand the build system and the very basics of the syntax.
Part II expanded on this to teach you all the C++ you’ll need to do basic work in the language, including a few useful parts of the standard library, such as vectors and strings.
You now know all the basics we need, and the actual Win32 API should now be very simple to deal with. Not elegant or consistent, but comprehensible as long as you keep a close eye on the documentation and take nothing for granted.
A .NET Developers Guide to C++ (part II)
Tuesday, September 8th, 2009Welcome to the second installment in my guide of “what you need to know if you’re a .NET programmer who wants to be able to write C++ code and call native APIs”. It took me much longer to get this posted than I’d hoped. My work on my thesis has kept me more busy than I’d originally expected. Sorry for the delay!
In part I, I went through a minimal “Hello World” program in some detail, and attempted to explain the arcane workings of the C/C++ compilation model. Some may argue that this had no relevance to my target audience, but I think it is a necessary evil. Almost all C++ programmers get tripped up at some point by the the difference between compiler and linker errors, and what exactly the #include directive actually does. Hopefully, by reading part I, you’ll be able to avoid this.
With that out of the way, we can get started on the interesting part, though. Part II will focus on actual C++ code. We won’t consider managed interop or even the Win32 API yet, though. This part will still take place in native C++-land only. In short, the purpose of this part is to enable you to write simple C++ programs, and more importantly, to understand the C++ sample code you probably run into from time to time.
A .NET Developers Guide to C++
Monday, August 17th, 2009One of my coworkers is essentially a self-taught programmer, but he is interested in, and wants to learn, absolutely everything. A year or two back, he asked me to give him a crash course in C++, because he felt it was a problem that whenever he needed to do something that required functionality not exposed by the .NET framework, he essentially hit a wall.
So we took an afternoon out to run through some basic C++ code, and while we had fun doing it, and I’m pretty sure he found it interesting, it didn’t really achieve the goal of making him comfortable with writing small C++ programs to communicate with native APIs such as the Windows one.
The Great Pointer Conspiracy
Thursday, July 30th, 2009One of the great tragedies of C and C++ is that they are taught wrong — that a number of perfectly straightforward features are taught and described as if they were mythical and supernatural entities that no mortal can truly understand. Memory management in C++ is one such feature (it is actually very simple, once you know the trick), but the biggest of all is probably pointers.
Everyone who learns C++ fears pointers. Everyone who is new to the language, or who has merely heard of the language consider pointers to be some kind of magic — arcane constructs that give the programmer access to Real Ultimate Power — a feature that both mark C/C++ as superior and more powerful than other languages, but is also feared as dangerous or unsafe*.
None of this is true.
Pointers are simple.
Pointers are not magical.
Pointers are safe (as long as you use them only as allowed by the language)
Thesis
Tuesday, July 28th, 2009Finally, after too many years studying at DIKU, I’m about to start on my master’s thesis. That feels weird.
But I’m still not sure what I want to write about. I’ve got a few ideas, mainly by asking some of the professors I might want as advisors if they had any interesting projects lying around. (more…)
RIP C++ concepts
Monday, July 20th, 2009So I just discovered that Concepts have apparently been dropped from the C++0x standard draft.
On the surface, a strange, strange decision. Concepts was, probably more than anything else, the face of C++0x. Removing that is going to make a lot of people wonder “so why do we need the new standard again?”
It was billed as the feature that would make C++ usable for non-experts again. It was going to show C# generics and their anemic constraints mechanism “how it should be done”. And now it’s gone. Why, and what does it mean for C++?