public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* random_sample: where did it go?
@ 2002-08-19 20:13 Igor Markov
  2002-08-19 20:18 ` Andrew Pinski
  0 siblings, 1 reply; 5+ messages in thread
From: Igor Markov @ 2002-08-19 20:13 UTC (permalink / raw)
  To: gcc

   Here's another piece-o-code that works with 3.0 but not with 3.1

/n/gagarin/z/imarkov/devel/ /usr/bin/g++-3.0 testR.cxx
/n/gagarin/z/imarkov/devel/ /usr/bin/g++-3.1 testR.cxx
testR.cxx:2: `random_sample' not declared
/n/gagarin/z/imarkov/devel/ cat testR.cxx
#include <algorithm>
using std::random_sample;
int main(){}
/n/gagarin/z/imarkov/devel/ /usr/bin/g++-3.1 testR1.cxx
testR1.cxx:2: `random_sample' not declared
/n/gagarin/z/imarkov/devel/ cat testR1.cxx
#include <algorithm>
using __gnu_cxx::random_sample;
int main(){}
/n/gagarin/z/imarkov/devel/ uname -a
Linux gagarin.eecs.umich.edu 2.4.18 #6 SMP Mon Jul 15 12:00:46 EDT 2002 
i686 unknown
/n/gagarin/z/imarkov/devel/
--
   Igor L. Markov         (734) 936-7829       EECS 2211
   http://www.eecs.umich.edu/~imarkov



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

* Re: random_sample: where did it go?
  2002-08-19 20:13 random_sample: where did it go? Igor Markov
@ 2002-08-19 20:18 ` Andrew Pinski
  2002-08-19 20:40   ` Igor Markov
  0 siblings, 1 reply; 5+ messages in thread
From: Andrew Pinski @ 2002-08-19 20:18 UTC (permalink / raw)
  To: Igor Markov; +Cc: gcc

try:

#include <ext/algorithm>
using __gnu_cxx::random_sample;
int main(){}


Thanks,
Andrew Pinski

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

* Re: random_sample: where did it go?
  2002-08-19 20:18 ` Andrew Pinski
@ 2002-08-19 20:40   ` Igor Markov
  2002-08-19 21:05     ` Phil Edwards
  2002-08-20  9:50     ` Jonathan Lennox
  0 siblings, 2 replies; 5+ messages in thread
From: Igor Markov @ 2002-08-19 20:40 UTC (permalink / raw)
  To: Andrew Pinski; +Cc: gcc

Andrew Pinski wrote:

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

* Re: random_sample: where did it go?
  2002-08-19 20:40   ` Igor Markov
@ 2002-08-19 21:05     ` Phil Edwards
  2002-08-20  9:50     ` Jonathan Lennox
  1 sibling, 0 replies; 5+ messages in thread
From: Phil Edwards @ 2002-08-19 21:05 UTC (permalink / raw)
  To: Igor Markov; +Cc: Andrew Pinski, gcc

On Mon, Aug 19, 2002 at 11:40:11PM -0400, Igor Markov wrote:
>    What do I do, in general, when I don't see
>    my favorite function in
> http://gcc.gnu.org/onlinedocs/libstdc++/libstdc++-html-USERS-3.1/namespacemembers.html

Also look in namespaces.html.


>    For example, random_shuffle() is there, but random_sample() is not.
> 
>    Another one: power()
>    Ok, I can guess, it's in <ext/numeric>  :)
>     but this makes things harder to figure out
>    and also requires lots of #if(GCC_VERSION)
> 
>    Is there some way to avoid obfuscating source code
>    with detailed gcc version checks?

Don't depend on functions that aren't in the ISO Standard Library being
in namespace std.  As we find them, we move them to __gnu_cxx.

Also, be aware that not every function is listed in the URLs above, only
because we haven't had the time to get to all of them.  See todo.html for a
very small fraction of what's left to be done.


Phil

-- 
I would therefore like to posit that computing's central challenge, viz. "How
not to make a mess of it," has /not/ been met.
                                                 - Edsger Dijkstra, 1930-2002

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

* Re: random_sample: where did it go?
  2002-08-19 20:40   ` Igor Markov
  2002-08-19 21:05     ` Phil Edwards
@ 2002-08-20  9:50     ` Jonathan Lennox
  1 sibling, 0 replies; 5+ messages in thread
From: Jonathan Lennox @ 2002-08-20  9:50 UTC (permalink / raw)
  To: Igor Markov; +Cc: Andrew Pinski, gcc

Igor Markov writes:
>  Another one: power()
> Ok, I can guess, it's in <ext/numeric>  :)
> but this makes things harder to figure out
> and also requires lots of #if(GCC_VERSION)

> Is there some way to avoid obfuscating source code
> with detailed gcc version checks?

You can use autoconf to search for the symbols, rather than checking for gcc
versions directly, if you're using autoconf 2.5x.  (Autoconf's checking for
type definitions in 2.1x is poor enough that you want to use the later
version.)

Checking for template types is somewhat tricky, because the comma in the
type name interferes with the syntax of m4, so you have to over-quote.  (I
think this is an autoconf bug, which I've reported.)  I've attached a
configure.ac file which works for me for detecting libstdc++'s hash_map
template class; tested with gcc 2.95.2, 3.0.2, and 3.1.

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

end of thread, other threads:[~2002-08-20  9:50 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-08-19 20:13 random_sample: where did it go? Igor Markov
2002-08-19 20:18 ` Andrew Pinski
2002-08-19 20:40   ` Igor Markov
2002-08-19 21:05     ` Phil Edwards
2002-08-20  9:50     ` Jonathan Lennox

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).