Posts Tagged ‘c++’

Hopes for 2010: Microsoft Visual C++

Wednesday, December 30th, 2009

As I men­tioned ear­lier, I’d like to cel­e­brate the new year by call­ing out a few prod­ucts I’d like to see improved in the new year.

First in line is Microsoft’s C++ com­piler and IDE. (more…)

Houston, we have a (performance) problem

Tuesday, December 15th, 2009

Ouch. These last few days, I’ve been fix­ing a few lin­ger­ing bugs in my STM sys­tem, and last night, I finally nailed them. Specif­i­cally, it is now pos­si­ble to open vari­ables within a trans­ac­tion as read-only. An obvi­ous opti­miza­tion, right? At least that’s the idea. Less work is required by the STM sys­tem if we can trust that the vari­able isn’t mod­i­fied by this trans­ac­tion. (more…)

Using My STM Library

Monday, November 30th, 2009

As promised yes­ter­day, I’d like to show off a few bits of my STM library. Of course it’s far from done, and is still miss­ing sev­eral key fea­tures, but the core library is in pretty good shape. So as they say on the inter­nets, “my STM library, let me show you it” (more…)

Being functional in an imperative language

Saturday, October 3rd, 2009

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. (more…)

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

Thursday, October 1st, 2009

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.

(more…)

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

Tuesday, September 8th, 2009

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.

(more…)

A .NET Developers Guide to C++

Monday, August 17th, 2009

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.

(more…)

The Great Pointer Conspiracy

Thursday, July 30th, 2009

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)

(more…)

Thesis

Tuesday, July 28th, 2009

Finally, after too many years study­ing at DIKU, I’m about to start on my master’s the­sis. That feels weird.

But I’m still not sure what I want to write about. I’ve got a few ideas, mainly by ask­ing some of the pro­fes­sors I might want as advi­sors if they had any inter­est­ing projects lying around. (more…)

RIP C++ concepts

Monday, July 20th, 2009

So I just dis­cov­ered that Con­cepts have appar­ently been dropped from the C++0x stan­dard draft.

On the sur­face, a strange, strange deci­sion. Con­cepts was, prob­a­bly more than any­thing else, the face of C++0x. Remov­ing that is going to make a lot of peo­ple won­der “so why do we need the new stan­dard again?”

It was billed as the fea­ture that would make C++ usable for non-experts again. It was going to show C# gener­ics and their ane­mic con­straints mech­a­nism “how it should be done”. And now it’s gone. Why, and what does it mean for C++?

(more…)