Unhinged Ramblings.

The Description. It describes. A blog. My blog. I blog. Here.

Wednesday, August 22, 2007

That new c++

I read recently that c++ was getting another overhaul. Well, Ive been exposed to the current c++ standard for 10 years now, and I still dont like it.

That said, it strikes me that c++ could use a lot of improvement. Especially in the area of code safety. In the modern world of multi core CPUs and SQL injection attacks it seems that there is a lot of scope for the base language to try and help programmers out a bit more by tracking variable tainting and synchronization.

Imagine if c++ had keywords that allows variables (and functions) to be marked as tainted, or as synchronized - just as variables are currently marked as const.

Then the compiler enforce rules (by way of emitting errors) should the programmer attempt to assign tainted data to an untainted variable - and access to "synchronized" variables would likewise cause compiler errors if called from an unsynchronized context. All done, neatly, at compile time.

Thursday, July 19, 2007

The problem with Linix

The problem with development on Linux is this bloody re-invent the wheel again and again attitude.

As a developer targetting windows I am used to the idea of modular components that are re-used.

Then, while trying to implement an SSL layer that works on all Windows OS's from 95 to Vista I encouter this piece-of-shit called OpenSSL that really sums up why I can never get my head around writing apps for Linux.

OpenSSL is a beast that goes against all my experience programming windows, all that I learnt in Computer Science. There is no attempt at all in the thing to leverage the base platform. Everything has to be done from scratch inside the thing: Does it use the host systems certificat store? no. asn.1 certificate parsing, its own buffering classes, socket wrappers, every cryptographic function under the sun and finally, on top of all that, the actual interface used to create SSL sessions is barely documented. About the only thing it doesnt do is include its own socket stack.

The sad thing is I guess, that this level of bloat is necessary - on Linux I guess theres no System32 folder just chock full of already implemented things.

Wednesday, June 27, 2007

Things I wish c++ could do.

I feel that the new c++ spec was largley a waste of time. When it was released I was filled with hope. The interveneing 10 years have made me bitter, very bitter. Instead of wasting their time on the acedemic improvement of the language, they could have spent some time giving use "useful" features.

1. functions as variables. Scripting languages like lua have it made. functions are treated as first class variables and can be freely reassigned and passed around. c++ has function pointers, but you just cant do the kind of stuff that you can when all function names are implicitly function pointers!

2. The ability to assign 'this'
this = (CMySelf*)pvParam;
Good grief. Static class members are one thing, but please let us actually assign the this pointer when we figure it out, and subsequently access class members.

3. forward inheritance of pure virtual methods.
Templates were an ok idea I guess and allow some neat generic ADT classes to be built. I dont belive they are the right solution for the problem of how to provide a base class that implements IUnknown.

All I want is a nice, non template based syntax, that lets me say

class CUnknownImpl : public IUnknown;
class CDispatchImpl : public CUnknownImpl, public IDispatch;

without the compiler getting all snarky about IDispatches' IUnknown methods being pure virtual when I clearly have provided #*%&ing implementation!

4. Writable vtables.
Why are vtables the only unwritable members of a class? This goes hand in hand with point #1. Virtual functions should be first class variables. Do all the method signature checking needed, but the ability to directly manipulate which implementation a particular vtable member points to at runtime would be damn sweet and save a lot of redundant framework effort.

5. Who screwed up void**?
In C, a pointer to a pointer to something can implicitly be converted to a void**. In c++ we have to have an explicit cast. What safety has been added by this requirement? Now, every call to QueryInterface needs a (void**)&pInterface. C has the type safety advantage here as it can at least check you have the correct level of indirection.

I am a fossil.

Once, long ago, I was into new stuff. I always made sure to have the latest and greatest of whatever Microsoft was releasing as soon as it hit pre-alpha. Via whatever nefarious means I could. Hell - I was a student. Lets not pretend I ever paid for anything.

Now, I find myself avoiding .NET, avoiding C#, avoiding XML. Screw it, I am avoiding C++ and thats what I do. The new c++ that is. The one with the templates and new fangled casts and far too many <>'s. C++ in my mind is not meand to have <>'s. Anywhere. Ever. That kind of crap is for XML, and I avoid that like the plague.

Labels: ,

Tuesday, July 12, 2005

I am engaged.

Some may wonder why my World of Warcraft characters have been languishing now in the level 40's for over 9 weeks.

Because I found a wonderful girl, and subsequently proposed to her. Yeah. I'm suprised too.

Friday, December 03, 2004

DevStudio 6 can load crash dumps

Ok, heres a fun trick when it comes to debugging particularly interesting problems. the sort of interesting problem that occours when you dont have DevStudio handy, but would really like to examine the state of the machine as it crashed, using the debugger.

Enter crash dumps - a complete snapshot of the process memory, in a state such that a debugger, like WinDbg, or even DevStudio, can load it up and display it as though it was a real app that had just crashed.

First setup DrWatson. From the command line run 'DrWtsn32 -i' to install DrWatson as the default just in time debugger, and then again run 'DrWtsn32' just to set it up to generate a crash dump.

Next, open up the registry key HKCU\Microsoft\DevStudio\6.0\Debug and add or edit the REG_DWORD value CrashDumpEnabled to '1'.

Now, once youve obtained your crash dump as a .dmp file, open up a new instance of DevStudio and choose 'Open Workspace'. In the Filetype selector there should be a new, previously unseen option; 'Dump Files (.dmp)'.

Monday, November 15, 2004

Startrek - more fucked than ever.

Oh good grief. The new season of enterprise is worse than ever. What moralistic preaching crap.

At last, a group of competent humans appears on the scene. They actually kick kilngon ass. And are immediately made out to be intrinsically evil.

Sheesh.

Friday, October 29, 2004

The real cost of microsoft windows.

Phrased as 60 sacks of soybeans it does sound a bit much doesn't it?