[DGD] Shouldn't this be a type error?
Noah Gibbs
noah_gibbs at yahoo.com
Mon Feb 2 16:51:03 CET 2004
I have a function in its own file. I'm running it
with the Kernel Library, unmodified. I compile the
object and run this function. Everything works just
fine. My question: shouldn't this give a type error
when I assign the result of "allocate()" to an "int*"?
Shouldn't I have to use allocate_int when I'm in
typechecking mode 2?
The function:
mixed count_digits(string str) {
int *num_count;
int ctr;
object user;
num_count = allocate(10);
for(ctr = 0; ctr < 10; ctr++) {
num_count[ctr] = 0;
}
for(ctr = 0; ctr < strlen(str); ctr++) {
num_count[str[ctr] - '0']++;
}
user = this_user();
user->message("Count: [");
for(ctr = 0; ctr < 10; ctr++) {
user->message(num_count[ctr] + " ");
}
user->message("]\n");
}
=====
------
noah_gibbs at yahoo.com
__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free web site building tool. Try it!
http://webhosting.yahoo.com/ps/sb/
_________________________________________________________________
List config page: http://list.imaginary.com/mailman/listinfo/dgd
More information about the DGD
mailing list