Moving over to blog.senthilthecoder.com

Having become a GNU toolchain developer, I have decided to stop blogging here and continue blogging at http://blog.senthilthecoder.com. Mostly because I don’t think it’s appropriate to blog about non-Microsoft related work under the msmvps.com domain. If you have subscribed to this blog, please reset your rss feed URL to http://blog.senthilthecoder.com/index.xml instead.

Moved over to the dark side

Yes, I’m now a Linux developer. About 6 months back, I got an opportunity to work on the AVR Toolchain – a port of GCC and related software for the AVR and AVR32 microcontrollers. Having always been interested in compilers and programming languages, I grabbed the chance with both hands, and have been happily hacking on it since then. While GCC can be developed on Windows, Linux is the natural platform and is what most developers use, so I had to switch to Linux as well. The switch to Linux was frustrating for a while, as I suddenly had no access to … Continue reading Moved over to the dark side

Naggy now does lowlighting of excluded code!

Naggy, the AVR Studio extension I wrote that provided live compiler diagnostics, now supports visually showing conditionally excluded code, again courtesy Clang. You can download the latest version here. Most of the Clang integration code had to be rewritten for this though, as the “black box” API provided by Clang didn’t expose enough details to make this work. It took some time to get familiar with that, and I still don’t think I’ve understood Clang’s idea of object ownership completely, but boy, was it fun! I basically register a custom PPCallback with the Preprocessor and then listen to the entry/exclusion … Continue reading Naggy now does lowlighting of excluded code!

Choreo : Write VS like macros in AVR Studio

Choreo is an AVR Studio extension that lets you write and execute macros within the IDE. You can download it from https://github.com/saaadhu/choreo/downloads. The source code is available from https://github.com/saaadhu/choreo/. If you’ve used macros in Visual Studio or in any other tool, you probably need no further explanation, but for the others, here’s what MSDN says a macro is: “A macro is a series of commands and instructions that you group together as a single command to accomplish a task automatically. Macros allow you to automate repetitive actions.” Choreo macros are just IronPython functions that have access to DTE, the top … Continue reading Choreo : Write VS like macros in AVR Studio

Naggy : Live compiler diagnostics in AVR Studio!

If you’ve programmed in any managed language in Visual Studio, you’d have definitely seen those nagging red squiggles that appear as you type, telling you just how dumb you are, every time you pause typing. Might not be everyone’s cup of tea, but I’ve personally found them very useful; they save quite a few compile-groan-swear-fix-compile cycles. So I decided to write a similar “squiggly generator” for AVR Studio 5, the product that I’m working on with a bunch of other guys. Naggy is what I call it, and it is a VSIX extension that installs into AVR Studio 5. You … Continue reading Naggy : Live compiler diagnostics in AVR Studio!

Ramble – a Ruby sentence generator

There was an interesting problem at work recently, where I basically wanted to generate a whole lot of C language expressions for testing purposes. Rather than generating them by hand, I wondered if I could somehow feed the C language grammar into a program and get most, if not all, possible valid expressions out of it. Of course, I knew that a syntactically valid program might not necessarily by semantically valid, but I figured that I could eliminate or transform those cases manually. So off I went, using this problem as an opportunity to write some Ruby code. The end … Continue reading Ramble – a Ruby sentence generator

When gmail.google.com didn’t actually go to GMail

The other day, I logged on to my home network and entered gmail.google.com from Firefox. Imagine my surprise when I got a “landing” page with a bunch of URLs, rather than the usual spartan GMail page. One terrifying thought followed the other. Was my machine infected? Was my WiFi router compromised? Maybe the ASDL modem? Worse, how long had it gone unnoticed? Ok, time to take a deep breath and start isolating the problem, I figured. I logged on from an alternate machine and found it worked fine there. I did a nslookup from the command prompt on my machine … Continue reading When gmail.google.com didn’t actually go to GMail

Why you should always dispose DataGridViews

Because your application can crash otherwise, that’s why. While it’s always a good idea to explicitly dispose everything that is disposable, we can usually get away without disposing UI controls because a. Complex controls aren’t created often – a single instance is often reused. b. The finalizer kicks in and saves the day. If you’re creating multiple instances of a System.Windows.Forms.DataGridView, however, watch out, because (b) doesn’t happen at all if you don’t call Dispose or otherwise cause the control to be destroyed. When debugging a software crash dump recently, I found that the crash occurred because there was an … Continue reading Why you should always dispose DataGridViews

When a C++ destructor did not run – Part 2

In the previous post, we saw that linking a C++ static library compiled with /EHs to a mixed mode application prevented the destructor from running when an exception is thrown. Here’s the sample project that demonstrates the behavior, in case you aren’t convinced. This is the code inside the library. 1: C::C() 2: { 3: cout << "Constructed" << endl; 4: } 5:  6: C::~C() 7: { 8: cout << "Destructed" << endl; 9: } 10:  11: void SomeFunc() 12: { 13: C c; 14: throw std::exception("Gone"); 15: } And this is the code consuming the library. 1: int main(array<System::String … Continue reading When a C++ destructor did not run – Part 2

When a C++ destructor did not run – Part 1

Consider this piece of C++ code. 1: using namespace std; 2:  3: class C 4: { 5: public: 6: C() 7: { 8: cout << “Constructed”; 9: } 10: ~C() 11: { 12: cout << “Destructed”; 13: } 14: }; 15:  16: void SomeFunc() 17: { 18: C c; 19: throw std::exception(“Gone”); 20: } If you know any C++ at all, you’ll know that when SomeFunc returns, both “Constructed” and “Destructed” will be printed to the console. That is because C++ guarantees that the destructor of an object created on the stack will always run when control leaves the scope, … Continue reading When a C++ destructor did not run – Part 1