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?
> 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.
> >the 'C cast' is something like (int *)foo. It's supported in C++, but
> >we
> >shouldn't use it.
>
> As far as I understood all those are different ways to hell ;-)
C casts and reinterpret casts are a quick route to hell. The other casts
are slower ways to hell :}.
> 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.
Rob
This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:18:39 MST