public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* [gcc-in-cxx] replacing qsort with std::sort
@ 2009-08-12  9:59 Pedro Lamarão
  2009-08-12 13:12 ` Richard Guenther
                   ` (2 more replies)
  0 siblings, 3 replies; 15+ messages in thread
From: Pedro Lamarão @ 2009-08-12  9:59 UTC (permalink / raw)
  To: gcc

I've recently started my contributions to the gcc-in-cxx project, and
eventually decided on the qsort suggestion because it seems the
easiest one.
I've made the change in three places in cp/classes.c; the patch can be
found here:

  http://code.google.com/p/ccppbrasil/wiki/GccInCxx

Is this the way to go?

Some questions occurred to me: in order to support a C and a C++
compiler at the same time, what "portability" mechanism should be
used? #ifdef guards to switch between qsort and std::sort on the spot,
based on __cplusplus? Should a helper function be declared somewhere?

Also, std::sort requires a "less" function on reference-tovalue-type,
so the current foo_cmp functions can't be reused.
Would a separate patch to introduce foo_less variants be acceptable
for GCC 4.5 right now?

Also, is the gcc-in-cxx branch still active? Should my objective be to
contribute patches to this branch?

On a side note, I've studied vec.h and found it hard to change.
One reason is because this header is included by the gen*.c stuff,
which is still being compiled by a C compiler, even when building with
a C++ compiler is enabled.
I've considered providing a separate version of vec.h when C++ is
being used, to avoid infinite #ifdefs.
Is this a good idea?

--
 Pedro Lamarão

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2009-09-02 12:57 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-08-12  9:59 [gcc-in-cxx] replacing qsort with std::sort Pedro Lamarão
2009-08-12 13:12 ` Richard Guenther
2009-08-12 14:33   ` Pedro Lamarão
2009-08-12 13:21 ` Ian Lance Taylor
2009-08-29 11:26 ` Pedro Lamarão
2009-08-29 19:42   ` Magnus Fromreide
2009-08-30 10:37     ` Pedro Lamarão
2009-08-31 16:10       ` Richard Henderson
2009-08-31 16:18         ` Pedro Lamarão
2009-08-31 18:36           ` Richard Henderson
2009-08-31 18:54             ` Richard Guenther
2009-08-31 19:01               ` Richard Henderson
2009-08-31 19:06   ` Pedro Lamarão
2009-09-02  0:24     ` Michael Matz
2009-09-02 12:57       ` Pedro Lamarão

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).