Posts in Category: C

IDE Experiments 

Visual Studio

I have been a Visual Studio user for many years so trying out Visual Studio 11, isn’t a big surprise. I like the restyle that VS11 has received doesn’t encourage me to run out and get add-on to get VS theme add-on. As for C++ coding sadly I haven't had much time to see what the changes are but general functionality seems more stable such as intelligence, highlighting and the right click goto  definition. This functionality was broken in Visual Studio 2010, taking forever to find a definition in the same file. I also noticed a considerable improvement in compilation time, rebuild of my un-optimised(e.g. not precompiled header) library was greatly improved.


Example code: clapack

Aptana Studio (for PHP and JS)

I have started doing increasing amounts of web development for projects I am working on. Writing mark-up tools search systems and generally are all Ajax enabled with DOM. All my backend API is written in PHP although I may get tempted to change this at some point, but writing and managing the code has been a bit of a pain. Visual Studio has little(via add on) to no support for PHP and most other tools have out-dated versions of support for JS and HTML, not including the HTML5 draft standard. No obvious IDE has resorted in me abusing editors like notepad, programmers notepad, gedit, geany although all great for editing files not really designed for proper coding.

So over time I have played with a few different IDE’s including Eclipse with add-ons. Never really settling into one that I liked for long and often returning back to my trusty friends the editors. But I think I may have found a hit, Aptana Studio (modded eclipse) seems to be a nice environment for writing JS code especially.


Example code: secret-ish project ;)

A lot of functionality works well, auto complete function descriptions jump to file. Oh and good layout of windows (always a must in my book). Works through the multiple languages html,js,php so is a nice IDE. I have to use it for a few more weeks but I think this one is a keeper!

Saturday, May 26, 2012 10:17:06 AM Categories: C IDE Programming Software Tech WebDev

gcc compiler dynamic array declaration without warning 

I demonstrate for one of Prof Richard Bowden's modules on C programming for first year Electronic Engineering students. Recently one of the tasks given to students was read in a matrix, multiply and write it out. To start with they did 3x3 then 7x7 then were instructed to make it variable size.

So when going round to help I showed a few of them how to allocate deallocate dynamic memory then asked the question had they been taught this. Apparently at they hadnt by this point, later finding out it comes up after Christmas.

My ramblings today are not about the module content or structure but actually the gcc compiler. When learning to program in C++ I learnt on a fairly sensible compiler inside Visual Studio. Then hit the gcc compiler and got annoyed by stupid things, for example

Visual Studio interprets this fine



Error, required:

std::vector<std::vector<int> >

To note the space between the last two angle brackets.

While walking round I saw some students code and got a little scare by it they performed operations such as:


int size = 0;


int myArray[size];

for (int i = 0 ; i < size ; i++)


for (int i = 0 ; i < size ; i++)



To my horror this compiled without warning or error and even worse it worked. I later while chatting to friends found that this was normal for the gcc compiler, and apparently the g++. So therefore we had some guesses about how this would work and the common answer was:

myArray is initialised to length 0, then since taken of the stack when read and written to you corrupted the stack.

The message to take away from this horror story of teaching C, is two things use a compiler that may not follow the letter of the standard but actually is intelligent and knows what you mean; always use -wall when compiling on gcc otherwise you will end up in a pile of mess later on!

Wednesday, December 14, 2011 10:48:00 AM Categories: C Programming
Stuart James