Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Class templates and inlining (OT)

Author: David Rasmussen

Date: 15:07:35 12/23/02

Go up one level in this thread


On December 23, 2002 at 17:58:22, Sune Fischer wrote:

>On December 23, 2002 at 17:38:39, David Rasmussen wrote:
>
>>There are several possibilities:
>>1. MSVC6 is not the most compliant compiler on earth, so don't expect anything
>>2. Maybe you are using this the wrong way? If you wrap things in a class, you
>>will have to explicitly give the type argument when you use the static member
>>functions:
>>
>>	int c=CUtil<int>::Max(a,b);
>>
>>Which is maybe not quite what you wanted. But that what you made :)
>>You might want to wrap the functions in a namespace instead.
>
>Yes, I looked over the STL, and I think I prefer the namespace, although that is
>cumbersome in its own way.
>

Cumbersome how? A namespace should be used whenever it is the best solution. A
class is a namespace (a restricted one), a namespace is not a class. You can do
almost anything with a namespace.

>>There are several
>>different ways of doing what you want to do. The best thing is for you to learn
>>how on your own. And if you really have to ask somebody, ask in comp.lang.c++,
>>not CCC :)
>
>LOL, those are the kind of answers i would have gotten in comp.lang.c++ those no
>good for nothing "start small" and "learn how to program" advises, somehow I
>find it very insulting :)
>

Sorry :)

>Besides compared to the high number of posts containing little else than
>personal attacks, I think this is on-topic.

When I directed you to comp.lang.c++, it was not because I thought you were
off-topic (I started the Two Towers thread :), but because I thought you would
get better help there. CCC is good for chess programming questions, but the
level of language knowledge isn't especially high in here.

>For sure you people here can
>understand why I can't possibly accept 15% loss of speed, in comp.lang.c++ they
>would never understand that. Before you know it the whole thread has become a
>debate of whether the 15% is "worth it" or not :)
>

People can understand that too in comp.lang.c++.

>>
>>Inlining hasn't been a practical problem with me, with MSVC. I just put the
>>relevant parts in a header file.
>>
>>C++ isn't slower for chess programming than C if used right. C++ can easily be
>>faster than C. The most important benefit though, is the type safety and the
>>superior designs possible.
>>
>>/David
>
>Yes, you don't have to convice me :)

Maybe I can convince the other readers :)

>I have changed most of my macros to inlined functions, and have seen no drop in
>speed yet.
>

Of course not.

/David



This page took 0.02 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.