Catch up on stories from the past week (and beyond) at the Slashdot story archive

 



Forgot your password?
typodupeerror
×

Comment Re:Lua[0]? (Score 1) 729

It is recent computer scientists that started

Not "computer scientists". Just C programmers. The first two languages designed, Fortran and Cobol, start at 1. Algol('68) and all the languages descended from or influenced by it let the programmer set the starting bound (this includes Ada, Pascal and all the other Wirth languages).

Pretty much every language that uses 0 as the only allowable starting index is either descended from C, or borrowed large amounts of its syntax from it. (Some BASICs use 0, but that language is so egregiously unstandardized that its tough to say anything about it with certainty).

That's because C does not have arrays, they are just syntactic sugar for pointers. array[index] is another way of writing *(pointer + offset)
Therefore: a[5] == *(a+5) == *(5+a) == 5[a]

Comment Re:Null Terminated Strings (Score 1) 729

I believe none of you actually programmed in C. A string terminated by \0 can be represented by a single pointer and an have any length. You can also easily let the string keep growing (until the allocated memory is finished.) That is the epitome of KISS. If you use an 8 byte character at the beginning then you are limited to a string length of 255. A structure with a length and a string pointer (or a character array) is much more complex and that would reflect in more complex library functions.

Some of us have been programming in C for 3 decades and have gained some sense of perspective. While the choice of using null-termination vs. explicit size may have been the correct one given the '60s and '70s state of the art, it is a poor one today.

Null-terminated strings have several serious deficiencies:
They cannot be used to store binary data, requiring another, redundant set of functions (with separate lengths)
Similarly, they cannot be used to store UTF-16
They are less efficient. In order to find the length of the string, get it's last character(s) or append to it, you must traverse it. If the string is long, parts of it may reside on pages that have been swapped out and touching them will trigger expensive IO operations.

There is a reason that every OO library uses a length+data for string objects

Comment Re:Get used to it (Score 1) 215

Until then any talk of "ending the war" is as silly as claiming you can tear down a dam because the river stopped flowing. It stopped flowing because of the dam.

Eh, the idea was that once the Iraqis had built up their own dam, slightly downstream from the US-built temporary dam, that we could remove the US dam and let the Iraqi dam take over.

Unfortunately, it looks like the Iraqi dam was made out of paper-mache... :(

Comment Re:Why? (Score 1) 97

'cause they aren't getting our money fast enough yet?

Re #2, Teh Beeb or someone on the telly said that the IPO was already for a front company, 'cause foreigners aren't allowed to own Chinese companies.

Also said some potential investors are shy because it's not clear whether / how long China will tolerate the kind of workaround set up for the IPO.

Comment Re:so (Score 1) 150

these are from the government officials who answer to people who were telling us a few years ago that the VA was the model of ideal healthcare delivery

The problem with the VA is that it had to handle a large influx of veterans returning from Iraq and Afghanistan, and there was no corresponding influx of resources to handle them. I don't know if the VA model was 'ideal' or not, but any system will hit the wall at some point if you keep increasing the load factor and never increase its resources.

Comment Re:Great idea at the concept stage. (Score 1) 254

This. There's likely trillions of dollars invested in IPv4 that is going to be around for decades. Consider the Internet like highways and train track widths - we're stuck with it for a very long time.

I'm probably missing the point, but isn't NDN just a way to do content-addressable lookup of data? And if so, why would we need to throw out IPv4 in order to use it? We already have lots of examples of that running over IPv4 (e.g. BitTorrent, or Akamai, or even Google-searches if you squint).

Comment Re:Stop Making Up Words! (Score 2) 157

Dude he can call it "cucumber" if he wants as long as it creates actual STEM jobs in North America.

Once it's built it will probably only employee low-paid assembly line workers and some managers.

(Which isn't STEM, but may still be an improvement on the way the USA has been hedded for the past few decades.)

Slashdot Top Deals

You knew the job was dangerous when you took it, Fred. -- Superchicken

Working...