From: | David McMinn |
Date: | 12 Jan 2000 at 14:32:26 |
Subject: | Re: Strings and things |
Hi amorel
> C=...and so you have a similar problem to Tony. Trouble is, there is
> no C=way of telling, for example, a long from a pointer. So you'd have
> to
>
> Ain`t this an exmaple of why pointers suck? Imho it is.
No, its an example of not being able to tell the difference between
two different types of variables that have the same size and can be
used interchangeably.
You can't tell the difference between a word and a long using a piece
of code (well, OK, you can use sizeof in this case). It would need to
be hooked into the compiler, like sizeof is. Perhaps something like a
"Typeof" command returns what type of variable it is.
Normally you wouldn't need something like this, as you define your
variables, and so you know what they are. The problem was that Evan
was asking about a generic routine that would go through a newtype
and print all the stuff that was in it. If the routine was to be
truely generic, then it would have to have some way of finding out
how many fields were in the newtype (another thing you can't do) and
what the type of each of these were, as strings are not stored
directly in a newtype - they have a pointer to the actual string.
I'll admit that the way they are implemented in Blitz is worse than
in C, but only for a couple of reasons. They still function perfectly
well as pointers.
If you think pointers suck so badly why don't you go and design a
computer system which doesn't rely on them?
---------------------------------------------------------------------
To unsubscribe, e-mail: blitz-list-unsubscribe@netsoc.ucd.ie
For additional commands, e-mail: blitz-list-help@netsoc.ucd.ie