Indeed. I don't expect to ever find much use for long long, because
C99 also comes with <inttypes.h>. Granted, it's not quite as general
as the scheme you propose, but it looks like it will do.
(<inttypes.h> is in some ways more general than your scheme. If I say
"int var : 64", does that mean the smallest signed integer type
holding 64-bits, or the fastest one (e.g. one that can be held in a
register), or what? <inttypes.h> deals with this. Of course, your
scheme could easily be extended, but it shows that once you start to
add facilities for declaring variables based on type properties, there
are a lot more properties to consider than just bit-width. If you want
PL/I, you know where to find it ;-))
The main point of long long is that it guarantees that there will be a
64-bit type, and so <inttypes.h> has definitions for int64_t
etc. Since C99 does not require a 128-bit extended integer type,
<inttypes.h> does not have to define int128_t etc. But it does reserve
the namespace, and it would take a very brain-dead vendor to have such
a type but omit the corresponding definitions from <inttypes.h>.
The other advantage of <inttypes.h> is that, even for platforms
without long long, it is very easy to write your own version of that
file and use it in your own projects on non-C99 platforms. Similar
techniques are already widely used, of course; all C99 does is fix the
names.
David Wragg
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/