Archive for c++


// November 20th, 2008 // Comments Off on Alchemy…. // .net, c++, RIA

I have not really been a follower of Macromedia (now part of Adobe) or its products; specially Flash, but I just found out about one research project that does capture my attention: Alchemy.

From the press release:

Alchemy is a research project that allows users to compile C and C++ code that is targeted to run on the open source ActionScript Virtual Machine (AVM2). The purpose of this preview is to assess the level of community interest in reusing existing C and C++ libraries in Web applications that run on Adobe® Flash® Player and Adobe AIR®.

This project promises that C/C++ libraries that have no OS dependencies can be run on the Adobe AIR platform. This is HUGE. Just to think that at least 90% of my libraries can be used in Web Applications is awesome.

A not so direct competitor, Microsoft’s Silverlight, does provide a way to reuse C++ libraries via C++/CLI, and it works like a charm; I happend to have a lot of C++ libraries  which have valuable code. Lately I have been reusing those libraries in Web Applications via C++/CLI and WebServices. It works, and it works fine.

I have not worked with Silverlight 2.0 yet; I have played around with it, but I have not done anything that is worth mentioning. In my tests, I see Ican also reuse those C++ libraries with C++/CLI and Webservices. The problem is that this approach will only work on Windows, since C++/CLI is not supported by Mono.

Another approach would be to make the WebServices in native C++, and call it from anywhere: Silverlight, Javascript and .Net. This would work anywhere.

This doesn’t take away the credit for Alchemy, which makes the C++ libraries natively accessible to Adobe AIR applications, in a way this is very close to what C++/CLI does.

The purpose of the Alchemy project is :

Alchemy is primarily intended to be used with C/C++ libraries that have few operating system dependencies. Ideally suited for computation-intensive use cases, such as audio/video transcoding, data manipulation, XML parsing, cryptographic functions or physics simulation, performance can be considerably faster than ActionScript 3.0 and anywhere from 2-10x slower than native C/C++ code. Alchemy is not intended for general development of SWF applications using C/C++.

Comparing it with C++/CLI, I do see an advatage from using C++/CLI to reuse C++ libraries in RIA applications over the Alchemy project: I can reuse .Net libraries with C++ native code, which gives me the best of both worlds.

I did some research on Alchemy, and it seems it doesn’t allow Flex code to be embedded with C++ native code. My research was not very comprehensive to say the least, so I could be wrong. It could also be too soon to tell since this is still in early stages of research and development.

In conclusion, this project seems very interesting, and I’m going to keep an eye out for it.

Console’s new version is out!!!

// August 25th, 2008 // Comments Off on Console’s new version is out!!! // c++, powershell, windows

Commonality’s Tomas Restrepo beat me to the news (by a couple of days). The new version of Console2 (v2.00b140) is out! Go grab it from their SourceForge page.

This console application makes a great console application, it can use cmd.exe, or Powershell or even bash (using cygwin). This application is very close to what GTerm is and it can also be transparent. The only problem that is see with it, is that there is no selection enabled yet, but it is a beta version.

I still love it. Go an dcheck it out!

State of the Language: C++0x

// August 21st, 2008 // Comments Off on State of the Language: C++0x // c++

I just found this interview with Bjarne Stroustrup in DevX about the current state of the new C++ spec recently tagged as C++0x, and now is known as C++09.

According to the interview, these are just some of the improvements the spec will contain:


  • memory model supporting modern machine architectures
  • Threading ABI
  • atomic types
  • mutexes and locks
  • thread local storage
  • asynchronous message exchange


  • regex: regular expressions
  • unordered_map, etc. (hash tables)
  • smart pointers
  • array: fixed-sized array
  • improvements to containers based on new C++0x features
  • tuples
  • date and time (maybe)
  • various library components to held library builders


  • rvalue references (move semantics)
  • static_assert: static assertions
  • variadic templates
  • strongly typed enumerations with scoped enumerators
  • constexpr: generalized constant expressions
  • control of alignment
  • delegating and inheriting constructors
  • auto: deducing a type from an initializer
  • decltype: a way of using the type of an expression in a declaration
  • control of defaults
  • nullptr: a name for the null pointer
  • a range-based for loop
  • lambda functions
  • raw string literals
  • UTF8 literals
  • concepts (a type system for template arguments)
  • initializer lists and uniform initializations syntax and semantics
  • in-class member initializers

Among others. Go and read the interview, it is very very interesting.

New Structum Site!!

// July 24th, 2008 // 2 Comments » // .net, c++, software development, windows

I have finished the first phase of the Structum site, which is the place where all of my projects will end up. I have some projects which have collaborators, but the work is mostly going to be done by myself.

Structum used to be my company when I lived in Mexico, and I left it to get a position in another company. I sold all of my products of the time to the company I moved to.

Now, I have been working on a set of projects which I plan to release through the Structum site and using (again!) the Structum brand.

The first project displayed is the RegEx Compiler. This project was displayed in my blog first, but I have moved it to the Structum Site and released a beta of the new upcoming release. The new features include an improved UI and Regular Expressions testing modules. It is not finished yet, so I don’t recommend it for production environments.

There will be more to come. Stay tuned.

UPDATE: The new site is here:

RegEx Pre-Compiler

// February 28th, 2008 // Comments Off on RegEx Pre-Compiler // .net, c++, software development

I have silently added a Software tab in this site, which will contain all the applications that I want to release for free to the public. I am still deciding if I’m going to include the source code. I’ll probably will, but for now only binaries will be there.

The first application is the RegexCompiler. This is a powerful tool that makes it easy to build common regular expression into .Net assemblies. Such assemblies can be used to organize and distribute commonly used regular expressions; in some cases, it even improves performance of execution of regular expressions.

This application was built for a very regex intensive application, and I wanted to have such expressions interchangeable using DLLs for my application. In some cases, if the expression is to big, it improves the performance of the regular expression, but this is not always the case.

This is an example of the final usage of the Compiled Expressions:

SelectPattern pattern = new SelectPattern();
bool isMatch = pattern.IsMatch(""select * from table1"");

Patterns are stored in an xml file with extension *.recproj. The application provides an example which is:

< ?xml version="1.0" encoding="utf-8"?>
<recproject name="Structum.Patterns.Data">
  <regex name="SelectPattern">(?ism)"[ t]?.*selectb(?-ism)</regex>
  <regex name="InsertPattern">(?ism)"[ t]?.*insertb(?-ism)</regex>
  <regex name="DeletePattern">(?ism)"[ t]?.*deleteb(?-ism)</regex>
  <regex name="UpdatePattern">(?ism)"[ t]?.*updateb(?-ism)</regex>

The whole file represents an assembly and it is identified by the ‘assemblyfilename’.
Each ‘regex’ tag contains the name of the Class and the actual Regular Expression. In the case of the Select Pattern:

  <regex name="SelectPattern">(?ism)"[ t]?.*selectb(?-ism)</regex>

Which is looking for expressions of the form: “select * from table”. It was used to identify select statements in code.

Also, this is my first application with C++/CLI. I’m a hardcore C++ fan, and I wanted to try the CLI version. While building the application, I was trying to have a more .Net mindset than C++, so that I could really learn the language. I have to say it was a really cool experience. It has been extremely useful for me, I hope it is also helpful for everybody else.

You can download RegEx Compiler in here.

A sample project can be found here.