Getting back on track

We’ve more or less set­tled in our new apart­ment, and we’ve got inter­net… sort of! Con­tinue read­ing Get­ting back on track

Still busy

Sorry for the lack of updates. I haven’t for­got­ten about this blog, but real life has kept me busy. The lease on my apart­ment expired Novem­ber 1st, so the last two months or so have been spent try­ing to find a new apart­ment (with greater and greater urgency as the dead­line got nearer). Con­tinue read­ing Still busy

Being functional in an imperative language

By now, I’ve read an awful lot of papers about STM sys­tems, and cer­tain trends are really start­ing to stand out, not so much in terms of the algo­rithms used or the clever schemes invented to make trans­ac­tions appear atomic, but in how they inter­face with the actual language.

It has really under­lined to me just how deeply entrenched most Java, C and C++ pro­gram­mers are in the imper­a­tive mind­set. Con­tinue read­ing Being func­tional in an imper­a­tive language

A .NET Developers Guide to C++ (part III)

We’re near­ing the end!

Part I focused on the very fun­da­men­tals of C and C++, mak­ing sure that you under­stand the build sys­tem 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 lan­guage, includ­ing a few use­ful parts of the stan­dard library, such as vec­tors and strings.

You now know all the basics we need, and the actual Win32 API should now be very sim­ple to deal with. Not ele­gant or con­sis­tent, but com­pre­hen­si­ble as long as you keep a close eye on the doc­u­men­ta­tion and take noth­ing for granted.

Con­tinue read­ing A .NET Devel­op­ers Guide to C++ (part III)

Software Transactional Memory

As I men­tioned a few weeks ago, I’m writ­ing my master’s the­sis on soft­ware trans­ac­tional mem­ory (STM).

Of course it is still early in the process, and while I’ve got some ideas for my imple­men­ta­tion, and have started pro­to­typ­ing parts of it, most of the time has been spent catch­ing up on all the exist­ing work in the field.

Lit­tle did I know when I accepted the sub­ject that there’d been writ­ten that many papers about it over the last decade. Phew… A com­menter asked me for the ref­er­ences I found use­ful, so here’s an incom­plete list: Con­tinue read­ing Soft­ware Trans­ac­tional Memory

A .NET Developers Guide to C++ (part II)

Wel­come to the sec­ond install­ment in my guide of “what you need to know if you’re a .NET pro­gram­mer 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 the­sis has kept me more busy than I’d orig­i­nally expected. Sorry for the delay!

In part I, I went through a min­i­mal “Hello World” pro­gram in some detail, and attempted to explain the arcane work­ings of the C/C++ com­pi­la­tion model. Some may argue that this had no rel­e­vance to my tar­get audi­ence, but I think it is a nec­es­sary evil. Almost all C++ pro­gram­mers get tripped up at some point by the the dif­fer­ence between com­piler and linker errors, and what exactly the #include direc­tive actu­ally does. Hope­fully, by read­ing part I, you’ll be able to avoid this.

With that out of the way, we can get started on the inter­est­ing part, though. Part II will focus on actual C++ code. We won’t con­sider man­aged interop or even the Win32 API yet, though. This part will still take place in native C++-land only. In short, the pur­pose of this part is to enable you to write sim­ple C++ pro­grams, and more impor­tantly, to under­stand the C++ sam­ple code you prob­a­bly run into from time to time.

Con­tinue read­ing A .NET Devel­op­ers Guide to C++ (part II)

Thesis, yay!

Been a bit quiet on the blog front lately. I’ve been busy get­ting my master’s the­sis off the ground.

But now it is offi­cial. Con­tinue read­ing The­sis, yay!

A .NET Developers Guide to C++

One of my cowork­ers is essen­tially a self-taught pro­gram­mer, but he is inter­ested in, and wants to learn, absolutely every­thing. A year or two back, he asked me to give him a crash course in C++, because he felt it was a prob­lem that when­ever he needed to do some­thing that required func­tion­al­ity not exposed by the .NET frame­work, he essen­tially hit a wall.

So we took an after­noon out to run through some basic C++ code, and while we had fun doing it, and I’m pretty sure he found it inter­est­ing, it didn’t really achieve the goal of mak­ing him com­fort­able with writ­ing small C++ pro­grams to com­mu­ni­cate with native APIs such as the Win­dows one.

Con­tinue read­ing A .NET Devel­op­ers Guide to C++

Spam spam spam spam spam spam

Looks like the spam­mers found me. Just had to delete 10 spam com­ments that appeared overnight. What a shame. I’m going to try enabling the Akismet anti­spam plu­gin. Hope­fully it doesn’t mark real com­ments as spam. If it does, my apolo­gies. Let me know and I’ll beat it into submission.

The Great Pointer Conspiracy

One of the great tragedies of C and C++ is that they are taught wrong — that a num­ber of per­fectly straight­for­ward fea­tures are taught and described as if they were myth­i­cal and super­nat­ural enti­ties that no mor­tal can truly under­stand. Mem­ory man­age­ment in C++ is one such fea­ture (it is actu­ally very sim­ple, once you know the trick), but the biggest of all is prob­a­bly pointers.

Every­one who learns C++ fears point­ers. Every­one who is new to the lan­guage, or who has merely heard of the lan­guage con­sider point­ers to be some kind of magic — arcane con­structs that give the pro­gram­mer access to Real Ulti­mate Power — a fea­ture that both mark C/C++ as supe­rior and more pow­er­ful than other lan­guages, but is also feared as dan­ger­ous or unsafe*.

None of this is true.

Point­ers are simple.

Point­ers are not magical.

Point­ers are safe (as long as you use them only as allowed by the language)

Con­tinue read­ing The Great Pointer Conspiracy