Complete.Org: Mailing Lists: Archives: freeciv-dev: May 2000:
[Freeciv-Dev] Re: OO model for Freeciv?
Home

[Freeciv-Dev] Re: OO model for Freeciv?

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: OO model for Freeciv?
From: 蔡恆華 <iquin@xxxxxxxxxx>
Date: Mon, 1 May 2000 23:57:14 -0400 (EDT)

> But I can't let a statement that that strcat call is more efficient than
> the C++ construct pass :) ) )
Sorry for not making myself clear. What I am trying to say is:
with the convenience, a programmer writes:
{
char *s = (char *)malloc(81);
s[read(file, s, 80)] = '\0';
s += '.';
}
instead of:
{
int x; char *s = (char *)malloc(82);
x = read(file, s, 80);
s[x] = '.'; s[x+1] = '\0';
}
I hope this not another bad example of mine :)
s = strcat((char *)realloc(s , strlen(s) + 2), ".");
is just the shortest generic way of doing s += '.';
It is not efficient at all. As for myself,
I always iterate through "gcc -O3 -S -o -" for crtical codes.

Regards,
I.Q.
______________________________________________
FREE Personalized Email at Mail.com
Sign up at http://www.mail.com/?sr=signup




[Prev in Thread] Current Thread [Next in Thread]