C vs C++ vs Lisp (156)

33 Name: dmpk2k!hinhT6kz2E : 2008-07-10 08:37 ID:Heaven

>>28

> Why don't you use these?

Because character literals are still null-terminated, so now we need two sets of string functions instead of one. That's a recipe for bugs galore.

This is why the standard library should be revamped: let's make something like bstring the standard and chuck out the current mess of fail.

> They are not that annoying.

They're useless.

> What exactly is local type inference?

Here's how we do it now:

int foo( int x )
{
int bar = x;
}

Here's how we could do it:

int foo( int x )
{
var bar = x;
}

The compiler figures out that var should be int, so you no longer have to provide the type for each local variable when you define it. It's a bit like a primitive form of Damas-Hindley-Milner type-inference in Ocaml or Haskell that only applies within a function.

Looks silly in this trivial example, but it's really nice anything bigger.

As mentioned in the other posts I just made, C# 3.0 and D both make use of it. So will C++0x.

> string literals do "support" unicode.

UTF-8. Now let's say I want to index or concatenate that. Whoops.

This thread has been closed. You cannot post in this thread any longer.