Back to home page

DOS ain't dead

Forum index page

Log in | Register

Back to the forum
Board view  Mix view

Vista (Announce)

posted by sol, 22.11.2007, 20:01
(edited by sol on 22.11.2007, 20:11)

I'll illustrate this a little better, too, with regards to API calls.

What happens if I write my own API call in the late 80s:

dword size_in_bytes = getHDSize(byte drive_letter)

Nothing wrong with that at the time; hard disk drives weren't going to reach into the gigabytes! And 640k RAM is enough for everyone! :)

Okay, now it's the 90s. What do I do? Well, I definitely need a new call:

qword size_in_bytes = getBigHDSize(byte drive_letter)

What do I do with the old one?

Return an error? Wrap it around the new one and truncate the answer? Return 0xFFFFFFFF? How will applications behave since they're getting the wrong answer?

There's no simple answer.

My code would probably look like this in the case of backwards compatibility in some simple pseudo code:

dword getHDSize(letter) {
  freespace = getBigHDSize(letter)
  if(freespace < 0xFFFFFFFF) {
    return truncateToDword(freespace);
  } else {
    return 0xFFFFFFFF;
  }
}


qword getBigHDSize(letter) {
  device = getDriveDevice(letter);
  return callDevice(device, GET_FREE_SPACE);
}


Now I've got extra code. All I used to need was the code 'getBigHDSize' now has.

Multiply this problem out for pretty much every API sooner or later. My OS is now way bigger, taking more disk space and requiring more RAM - also meaning it takes longer to load. The backwards compatible call takes much longer than it used to.

Now consider the nightmare debugging, when I don't know what's causing a bug when someone is trying to get hard disk size amount:

A) Was it a problem with the hardware, or a problem with my code?

B) Was it a call to my old code, or a call to my new code?

C) Was it a call to the old function on a big hard disk and the application not knowing how to deal with the wrong answer, or a problem with my function?

D) If it's a call to the old code, was it the extra logic in the old code that's new and not as well tested? Was it one of the other functions I had to add into my old code to make it work?

[edit to add code to illustrate better]

 

Complete thread:

Back to the forum
Board view  Mix view
22632 Postings in 2109 Threads, 402 registered users, 442 users online (0 registered, 442 guests)
DOS ain't dead | Admin contact
RSS Feed
powered by my little forum