So I found a rather interesting code generator bug in XCode that happens when converting a 64-bit floating point value to an unsigned 32-bit integer. Here's a good example of what I'm talking about in REALbasic: dim d as Double = -1.0 dim u as UInt32 = d MsgBox Str( u ) If you run that code, it will display 0, and not 0xFFFFFFFF like you'd expect! In fact, any negative number will still display 0. But this bug isn't limited to just the REALbasic compiler. You can see it in a straight-up C application too: double d = -1.0;
Recently in Programming Category
DWM is a great new Vista technology that allows you to create live thumbnails of application windows (among other things). If you use Vista, you've probably noticed DWM in action with the task bar: These thumbnails are a live view of what's happening in the window, and are quite a neat way to visually see what's happening "behind the scenes" so to speak. However, they have some very unfortunate drawbacks which are really annoying. For starters -- you can only display a thumbnail for a top-level window. This totally destroys them for the use I had in mind, as for
One of the programming projects I both love and dread is refactoring. I dread it because some of the code I have to refactor is amazingly old, dense, uncommented, undocumented and really hairy. But it's also the most satisfying feeling in the world to take code like that and turn it into something much better. For the past few weeks, most of my work life has consisted of refactoring in some way, shape, or form. I have one major refactoring project that I am working on, as well as some smaller "clean up" jobs. As I get burnt out with
Previously, I brought up a hypothetical API discussion to see what different people thought about the idea. The basic premise of the discussion was: what do you do when you've published an API to interact with something, and then the rules for that interaction change? Now I want to make that hypothetical discussion more concrete with a real world issue that's interesting to me. But, I want to preface this with: this post has no bearing on reality. Anything we discuss here is purely academic. I'm in no way saying that REAL Software is going to do something, change anything,
So here's an interesting question that I'd like to pose to my silent readership: how would *you* solve this particular issue, and why would you solve it in that particular way. Let's say you have a published API called Foobar, and Foobar's job is to tell you whether the user can access a particular resource. This API was sensible when you first published it, but over the years, the operating system has changed the game a bit. Now the OS has decided that the user can have "pretend access" to a particular resource in some circumstances, but they don't have
This one came in via email by way of Christopher, and I thought it might be a nice topic to discuss today: So I was thinking about how other developers think.. I seem to remember a post on the forums a while back along the same lines.. I find others thought processes interesting.. So I thought it might make a good blog post for you when you can't think of anything to write about.. Things like how you start to tackle a problem/project.. Do you jump right in or mull it over? Do you find yourself looking up API a
I know this isn't really programming related, but it's still something that only programmers (and other power users) will really get much use out of. Here's a list of handy tricks that seem to escape the notice of many people. Entering Unicode input: ever have the need to enter a unicode character, but don't have a keyboard layout that makes it simple to do so? If you're like me, the whole AltGr thing is really more pain than its worth because I can never remember what key I just pressed! Well, a handy IME trick that works in any newer
This question comes up fairly frequently, so I figured I'd take a few moments to explain why you should never use MDI in a new application. To truly understand why not, you have to first understand "why" -- so I'm going to give you a brief history lesson. Rewind about 20 years or so to the pre-Win9x days. At this time, the OS wasn't preemptive-multitasking (it was cooperative), which meant that switching between processes could be a dangerous thing. If the process in the foreground was hung, the whole machine was hung. What's more, the process in the foreground was
One neat new stability feature of Vista is the transactional file system functionality that the kernel exposes. This makes error checking almost trivial for file operations which are required to be completed as a set. The basic idea is that you start a transaction to obtain a handle, then do a bunch of operations using the transaction handle, and then commit (or rollback) the transaction using the handle. If something goes horribly wrong in the middle of the operations, you don't have to worry because the entire transaction is rolled back automatically (unless you commit it). So, let's say the
As per Kenny Kerr and Scott Hanselman, here's my take on three things I've learned about software both in and out of college. In College 1) It's not about getting the right answers. It's about getting the process right and jumping through hoops to do so, regardless of whether they make sense or not. 2) Java is the best thing since sliced bread. :: snorts :: 3) It's hard to learn when the person teaching you speaks broken English with a thich accent. Out of College 1) Good features mean more than just code -- accomplishing the feature is only