Welcome to MSDN Blogs Sign in | Join | Help

Browse by Tags

All Tags » coding   (RSS)
Today’s Bug is Brought to You by “Don’t Mix C and C++”
Take this for example: #include <iostream> #include <iomanip> class Storage { public : Storage() : m_val( -1 ) {} int m_val; }; class Holder { public : Holder() : m_double( 50000 ) {} union { double m_double; struct { Storage m_storage; int Read More...
Would You Add Easter Eggs To Software Produced At Work?
According to many Slashdot commenters , the answer was clearly “Yes! Just be tactful and careful, and make it über geeky.” Of course, those of us who live in the real world know the correct answer to be “Did you ask your boss first?” Otherwise, coding Read More...
Are You and Your Date Binary Compatible?
Many exciting things have been happening since we shipped Office 2007, but most have been "hush hush". As in "Chris, don't tell your friends you're working on TOTAL AWESOME FEATURE X as you will make them jealous." But not all my time is spent on cool Read More...
C++ Still Bites Back
I don’t know how many times I’ve thought to myself that I knew it all. Many times I’ve coded something that I was absolutely sure was correct only to find out I was drastically wrong. What’s wrong with this code? class Object { public : Object() : m_pdata( Read More...
OMG, You Broke Everything!!
As a new hire, you will mess up. But don’t sweat it, it's to be expected. You will learn more from a mistaked because you will be forced to find a solution when someone points it out. Indeed your success as a new hire isn’t a question of how few mistakes Read More...
I <3 Multiple Returns
Which piece of code is not only reasier to read, but more efficient? Example 1: const int size = 10; bool FindValue( int value ) { int arr[size][ size]; Load(arr); bool fFound = false ; if ( value != 0 ) // Must have value greater than 0 { value--; if Read More...
Needs more cow bell!
Anyone else code to video game music? OCRemix.org is one of my favorite sources of free “coding” tunes. And who doesn’t get pumped to the cowbell at the end of the Half-Life 2 credits music? Read More...
Poll: You learned Java or C++ first?
At the college you are attending or attended, was the focus on a native language (C, C++) or a managed language (Java, C#)? The first real language I learned was C++ and later when I had to take a class in Java, I thought it was very easy. However, I Read More...
What The Hell Does This Code Do?
Really, take your best shot: value += ((LPWORD)&((WORD *)data)[1])[i]; It’s not all that complicated, it’s not intentionally deceptive, but it is confusing. Such is life while working on a large project that you didn’t write. You will have to interpret Read More...
C++: The End All Be All...or not
Many people take C++ as the end all be all of languages. And why not? It supports many different paradigms of programming at once: functional, object oriented, templated, metaprogramming, assembly and probably more. But what doesn’t it support? I don’t Read More...
What’s Wrong With This Code
Not many people responded to last week's puzzle , so I'm going to leave it open for another week. In the mean time, take a crack at this. Here's something many of us would have written in college. Take a look at the code and see if you can spot what's Read More...
Messy Code Is Bad Code
My apartment is a mess. After a party on Saturday there are glasses, pizza boxes, dirty dishes, empty bottles and bottle caps scattered in every corner of my place. Some might ask: “Why don’t you just clean it?” Well, I’m a procrastinator. As long as Read More...
Computers Don’t Know Algebra
Take a look at this piece of code: if( length + 4 < length ) return ; Algebraically, it's always false. "A number plus 1 can never be less than the number itself, that's a fundamental property of addition!" Computers, however, are not perfect mathematical Read More...
Scientists and Engineers are Wrong!
Say the following question was on a Computer Science exam: Are you an Engineer or a Scientist? Explain. What would you put? I'll give you a bit of hint by your answer to this question: How much information can you store in linked list? 1. Infinite - Linked Read More...
Your Legacy
I'm sure you want to have a legacy. People will remember you and tell stories about what you did and look back at what code you wrote. Life would be grand, assuming your legacy was good that is. More likely people 10 years down the road will look at your Read More...
More Posts Next page »
Page view tracker