Re: static_cast in squid3

From: Evgeny Kotsuba <evgen__k@dont-contact.us>
Date: Sat, 09 Nov 2002 04:36:59 +0300

Hi,
On 09 Nov 2002 11:44:13 +1100
  Robert Collins <robertc@squid-cache.org> wrote:
>On Sat, 2002-11-09 at 11:04, Evgeny Kotsuba wrote:
>> Hi,
>> On 09 Nov 2002 09:20:18 +1100
>> Robert Collins <robertc@squid-cache.org> wrote:
>> >gcc 2.95 supports it. Can you be more specific about the gcc
>>version
>> >that doesn't? And is there a newer port of gcc for your OS?
>> >
>> >Hmm, IBM are usually quite good, is 3.08 there newest one?
>> IBM VAC++ 3.08 (made in about 1995) is imho most stable IBM compiler
>> for OS/2. VAC 3.65 and 4.0 both support it.
>
>What sort of problems do VAC 3.65 and 4.0 have?
I have a problems: VAC4.0 is too deep crazy object oriented for me. By
the way it is to VAC4 complexity that Sun could not make StarOffice
for OS/2.
>
>> The last stable version of EMX (GNU compiler and utils) for OS/2
>> contain GCC 2.8.1
>
>What about
>http://www.goof.com/pcg/os2/index.html
>?
>
>It looks like the ecgs fork and merge dropped most OS/2 support from
>gcc
>mainline. So, compatability with some version of VAC is important for
>OS/2.
I don't understand well what you are saying about. If about fork -
then it is not system supported and is emulated in emx and work a bit
worse than that in unix.

>
>> First, we don't use <iostreams>, I hope.
>
>Not at the moment. streams have the capability to make *many* of our
>debug statements more accurate and typesafe. We need to do some
>serious
>research and testing before using them though.
>
>> Second, I meant the qsort funstion and it's argument function.
>
>Oh!. Urck. I'd probably use the STL sort() template function, which
>uses
>introsort (same average complexity as qsort, better worst case
>behaviour). Alternatively, I'd implement a template qsort() function.
>
>Heck, it could be as straightforward as (no STL):
>
>template <class C>
>extern_inline int lessthan (C const *l, C const *r) {return *l < *c;}
>
>template <class C>
>inline void qsort(C * base, unsigned count) {
> qsort(base, count, sizeof(C), static_cast<int(*)(const void *,
>const
>void *)>(lessthan<C>));
>}
>
>Note that this reduces the typecasting to one place. Using it would
>look
>like:
>
>int main(int argc, char **argv)
>{
> Foo anArray[]={Foo(3), Foo(2), Foo(45)}
> qsort (anArray, 3);
>}
>
>But, I'd tend to use a sorted container if I needed regular access to
>sorted data. Containers are good, arrays are evil.

Defenetly you should read about Occam blade philosophy.
I think it can be possible to use normal qsort and two C-style type
cast

SY,
Evgeny Kotsuba
Received on Fri Nov 08 2002 - 18:37:05 MST

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:18:39 MST