Jump to content

  • Log In with Google      Sign In   
  • Create Account

dave j

Member Since 11 Oct 2002
Offline Last Active Feb 19 2016 11:38 AM

Topics I've Started


19 September 2013 - 07:18 AM

Many many years ago I was asked to alter a program written in BASIC by someone who had been learning to program as they went along. It was obvious that they only discovered subroutines part way through when I found the equivalent of the following in several places throughout the code:

10 REM early bit of code
20 GOSUB 40
30 GOTO 60
40 REM stuff they later decided they wanted to use in several places
60 REM some more program
70 GOSUB 40
80 REM rest of program
90 END

The documentation says those bits are reserved...

07 June 2013 - 06:22 AM

...that must mean we can use them.

Many APIs have flags words to contain a various options. Frequently not all the bits are used. Despite the fact that the documentation mentioned that all unused bits in flag words were reserved and should be set to zero, a GUI project that sat on top of OS/2's Presentation Manager (think Windows GUI - they are almost identical) used the reserved bits for it's own purposes. A few years later IBM changed OS/2 to use some of those bits. Not only did the framework need changing to not use those bits, 600 screens needed updating as well (think changing 600 Windows .RC files).

Top tip:

If you are documenting an API that has flag words, define every single unused bit in every flag word as "must be zero". If you define a standard for unused bits once at the begining of your documentation some idiot will not notice/ignore it.

String handling in C

10 March 2013 - 04:53 PM

In a former colleague's code about 14 years ago:

sprintf(str, "%s %s %s", a, b);

The value of str was displayed on screen after this. This had been live at a bank for a couple of years before it was discovered. The reason it took so long to notice is that the value on the stack that was used for the third string's address happened to point to a byte containing zero.

Virtually Famous

03 June 2011 - 03:20 AM

Quick heads up for those who can listen to UK radio stations.

BBC Radio 4 has a programme, called Virtually Famous, about indie game development at 11 AM today.

Details here.

The return of Jack Thompson

01 October 2009 - 09:18 AM

This time he's suing Facebook because he's upset that the site's users said nasty things about him. Register article: Game censorship crusader sues Facebook for $120m