background preloader

C++

Facebook Twitter

TIOBE Software: Tiobe Index. TIOBE Index for January 2016 January Headline: Java is TIOBE's Programming Language of 2015!

TIOBE Software: Tiobe Index

Java has won the TIOBE Index programming language award of the year. This is because Java has the largest increase in popularity in one year time (+5.94%). Java leaves runner ups Visual Basic.NET (+1.51%) and Python (+1.24%) far behind. At first sight, it might seem surprising that an old language like Java wins this award. Java's rise goes hand in hand with Objective-C's decline (-5.88%). Alexander J Turner sur Twitter : "#C++ #template #metaprogramming to create a non aliased sawtooth generator. Just got the code to run - mega excited!

Is COM In Resurgence? "They are doing it in COM - WHY?

Is COM In Resurgence?

" this (abridged) comment from a coffee machine conversation I had with some collegue a couple of years back sums up where COM was going. But now there are signes that the old war horse is back in the pasture preparing for battle. For the record - I do know what I am talking about here. It gets a bit frustrating that when I say stuff which is not the accepted wisdom, people comment assuming I don't know what I am talking about. So, now we have cleared this up we can get to the meat of this post! But Microsoft are clearly backing away from .Net rules all position. Pause for thought: If the UI is moving from Silverlight/C# to HTML5 and Microsoft cannot even move their own products over to .Net what does that say about the whole CLR platform? So, why am I talking about COM?

Reference Counting Is Not Deterministic! "Reference counting is the only truly deterministic form of garbage collection" is commonly held belief.

Reference Counting Is Not Deterministic!

It is wrong because reference counting is very far from deterministic. Computers are machines, not mathematical entities. As such, they do not always respond as expected when a mathematical model is applied to their behaviour. This seems never more so than in the area of multi-threaded interaction. Memory allocation is especially troublesome because we can create the most perfectly functionally oriented, share nothing programming model and find it performs completely differently from what we expect because the computer hardware does share something - memory! Garbage collection is major cross cutting issue in multi-threaded programming. What Language Should I Learn? Simple Handle Based Abstract Iterators In C. Writing Handle Accessed Abstract Iterators In Pure C Note: this is a draft quality post - I hope to tidy it up soon.

Simple Handle Based Abstract Iterators In C

A lot of what has been learned over the last 30ish years of OO development has been about how program structures and practices can be made simpler and more stable to use. Unfortunately, this has often gotten mix up in peoples minds with an over zealous desire to make everything into an object and make as many objects as is humanly possible. Will C++ Be Its Own Downfall. Sometimes the powerful and heavy can be taken down by the small and light weight.

Will C++ Be Its Own Downfall

My recent experience in C# and VB versa C++ lead to the (possibly sad) conclusion that C++ will force it self to become increasing marginalized in the new, highly parallel world of 21st century computing. The premature announcement of programming language death seems to be a recurring theme over the last half century. Taking The Pain Out Of JNI. I have just finished some performance technique research into JNI and found that all the JAVA_ stuff in C++ function names as A PAIN.

Taking The Pain Out Of JNI

Here is how to make writing JNI native code a very great deal more straight forward and less painful. When we first encounter JNI, most of us try out a little utility called javah. It takes a compile Java class (technically a compiled JVM class) and creates a C style header file. This file has function declarations in it which are of a special mangeled form so that the JVM, when asked to load a dll or shared object with these in it, will be able to dispatch the native marked JVM methods to the actual native methods.

So, write the Java class.Compile.Run javah.Write the function definitions to match the declarations created by javah. It is not hard to see why this seems like a good idea. JNIEXPORT jobject JNICALL Java_com_nerdscentral_vspl_VSPLJNI_00024VSPLInterpreter_interpret (JNIEnv* env, jobject obj, jobject incoming) C++11 thread_local Performance And Use For Legacy Code Upgrade. C++11 has a new storage type of thread_local.

C++11 thread_local Performance And Use For Legacy Code Upgrade

It is not fully implemented in VC++11 yet, but there is enough of a work around to make it usable. It shows the promise of being a very powerful tool for upgrading legacy single threaded code. Quant Calculations With Distributed Excel - 2. Hadoop is a Java framework.

Quant Calculations With Distributed Excel - 2

It can work via hadoop pipes with other languages via IPC. However, IPC (inter process communication) is slow and awkward. Indeed, that is exactly what we are having to do between Excel and Hadoop already. So, what ever hadoop uses to talk to Excel, we want that to be Java based. This leaves us with two choices: 1) Jacob - an off the shelf COM implementation for Java. 2) Hand write the driver for Excel in something else and access it from Java via JNI. C++11 Using thread_local for legacy code threading. A GOOD DAY: C++ VSPL works and meeting first class people. Today has been a fabulous day.

A GOOD DAY: C++ VSPL works and meeting first class people

I had a great meeting with some very interesting people this morning. What is the best way to unwind? Naturally, write some code :) Also check out the VSPL/Language development index page. A Try At Thread Safe Counted Pointers In C++ VSPL - So simple an amoeba can understand it!

A Try At Thread Safe Counted Pointers In C++

Whilst VSPL may (or may not) be simple, getting C++ to perform reference counting garbage collection in a multi-threaded environment - efficiently - does not seem to be. Here are some of my ideas so far. Also check out the VSPL/Language development index page. As part of my research into VSPL I am writing a C++ implementation. This s much more challenging than the C# (or vb.net or Java) versions because I need to figure out what to do for memory management. The single most important aim of VSPL is to be simple. 1,1>Sum The tokens are '1' ',' '1' '>' and 'Sum'.

The solution I am working with for now is smart counted pointers. If only life was that simple This is all great until you hit modern computer architectures. Is this the complete story. I considered two ways of implementing this 'turn off the counter' approach. Anyhow - here is the work in progress smart counted thread safe pointer class in the Windows code base: Thread Load Testing On *nix. Multi-threaded and realtime are moving forward at a break neck pace; testing is struggling to keep up; here I am working on a new version of my VSPL language in pure C++ for realtime, concurrent and multi-threaded testing. The funny thing is that when I first started work on the C# version of VSPL 3 years ago (wow - really?)

I had in mind just a Very Simple Programming Language. However, the model of the language soon proved to be ideal for load testing, especially in a multi-threaded environment. The reasons are: Complete transparency, there is no optimization or translation step between what you write and what is run. Differences from my previous versions of VSPL. Try/Catch/Finally Pattern Using RAII & Lambdas. I totally agree with Stroustrup's assertion that RAII is a better pattern than Try/Catch/Finally for resource management. Nevertheless, there are other things we might want to use finally for than just cleaning up resource. Here I show a very simple, clean and minimalist pattern for achieving finally clauses in C++11. In Java and C# development finally can be really handy for instrumentation during debugging or over key areas for logging. The key to my pattern is to use RAII semantics to cause a closure to be run when a 'finally' object goes out of scope.

This means that we can absolutely guarantee that the closure will be executed because the compiler guarantees to run the destructors of all auto variables when they go out of scope. The C++ Decade - 5 Reasons C++ Will Dominate The Next 10 Years. Goodness It Is Good! Most of my life I have driven low powered sensible cars. Recently my wife and I bought ourselves a 275hp V8 Mercedes CLK. Dropping to 3rd and flooring it is like nothing I had ever previously experienced; the acceleration, thrill and controlled power was a revelation. Lambdas and partial application. During writing my previous post I really wanted to use partial application but was in too much of a hurry to put it in. Here I show a nice pattern for implementing partial application in Visual C++11 (beta). Partial application with explicit named functors is old hat but also rather laborious.

C++ For Absolute Complete And Utter Newbs. I am creating this coarse to help my son learn C++. The aim is to teach C++ in a completely clean fashion with no contamination from the history of C and other programming paradigms. Something is only hard to understand if you say it is! So, let's get started by setting up a simple C++ development environment, for this we are going to go for Micro Soft's Visual Studio Express. When the installer asks what optional components you want (for this version, if you are reading this and there is a new version that does something else - sorry all bets are off!)... ... Now pick the default folder for installation - we want to keep everything simple!

C++ For VB Programmers.