From -5837413223092588335
X-Google-Thread: f78e5,1130da7a3640a78c
X-Google-Attributes: gidf78e5,public
X-Google-Language: ENGLISH,ASCII-7-bit
Path: g2news2.google.com!news2.google.com!news3.google.com!news.glorb.com!news.alt.net!comp-std-cpp-robomod!not-for-mail
From: "Greg Herlihy" <greghe@pacbell.net>
Newsgroups: comp.std.c++
Subject: Re: Deprecate the use of plain pointers as standard container iterators
Date: 6 May 2006 17:40:01 GMT
Organization: http://groups.google.com
Lines: 52
Approved: Fergus Henderson <fjh@cs.mu.oz.au>, moderator of comp.std.c++
Message-ID: <1146925399.228527.177770@j33g2000cwa.googlegroups.com>
References: <1146830242.416436.272780@g10g2000cwb.googlegroups.com>
   <1146842605.957240.37860@i39g2000cwa.googlegroups.com>
   <e3g12a$leh$1@news.Stanford.EDU>
   <445bb6ab$0$60786$157c6196@dreader1.cybercity.dk>
   <4c2kp3F13dairU1@individual.net>
Mime-Version: 1.0
Content-Type: text/plain; charset="iso-8859-1"
Return-Path: <devnull@stump.algebra.com>
X-Authentication-Warning: mulga.cs.mu.OZ.AU: fjh set sender to devnull@stump.algebra.com using -f
X-Robomod: STUMP, ichudov@algebra.com (Igor Chudov)
X-Original-To: std-c++@mailman.ucar.edu
Delivered-To: std-c++@mailman.ucar.edu
Delivered-To: std-c++@ucar.edu
X-Trace: posting.google.com 1146925406 10980 127.0.0.1 (6 May 2006 14:23:26 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Sat, 6 May 2006 14:23:26 +0000 (UTC)
User-Agent: G2/0.2
X-HTTP-UserAgent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/418 (KHTML, like Gecko) Safari/417.9.2,gzip(gfe),gzip(gfe)
Complaints-To: groups-abuse@google.com
Injection-Info: j33g2000cwa.googlegroups.com; posting-host=70.231.148.21;
   posting-account=JdllFQ0AAAC-QghphnHMZz5q0GHnzGUJ
X-Virus-Scanned: amavisd-new at ucar.edu
X-Virus-Scanned: amavisd-new at cs.mu.OZ.AU
X-Virus-Scanned: amavisd-new at cs.mu.OZ.AU
Xref: g2news2.google.com comp.std.c++:1798

Alf P. Steinbach wrote:
> * Thorsten Ottosen:
> >
> > Please see
> >
> > http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1870.html#add-iterator-utilities-from-boost
> >
>
> Titled "Crazy ideas", but they're not at all crazy.  Change the title.
>
> Also, I think it would be a good idea to add inclusion of pi and e
> constants in <cmath> and/or <limits>.
>
> There is existing practice for pi: having M_PI in <math.h>, but the
> uppercase stems from the C heritage and may conflict with macro naming.
>
> Here's a list of <math.h> constants from one very popular compiler:
>
>    M_E          e          2.71828182845904523536
>    M_LOG2E      log2(e)    1.44269504088896340736
>    M_LOG10E     log10(e)   0.434294481903251827651
>    M_LN2        ln(2)      0.693147180559945309417
>    M_LN10       ln(10)     2.30258509299404568402
>    M_PI         pi         3.14159265358979323846
>    M_PI_2       pi/2       1.57079632679489661923
>    M_PI_4       pi/4       0.785398163397448309616
>    M_1_PI       1/pi       0.318309886183790671538
>    M_2_PI       2/pi       0.636619772367581343076
>    M_2_SQRTPI   2/sqrt(pi) 1.12837916709551257390
>    M_SQRT2      sqrt(2)    1.41421356237309504880
>    M_SQRT1_2    1/sqrt(2)  0.707106781186547524401

The POSIX technical standard defines these 13 symbolic constants in
math.h (see X/Open CAE System Interfaces and Headers Issue 4, Version 2
pg. 780 from http://www.opengroup.org). Note that POSIX does not
require that these symbols be defined as macros - so it would certainly
be permissible to declare them as const doubles for a C++ compiler.

And while the C++ standard could also add these (or similar) constants
to math.h (or cmath), it's not likely gain much. Most C++ programs are
compiled on POSIX compliant OSes today, which means that, as a
practical matter, these symbols are already available to almost any C++
programmer who wishes to use them in a program.

Greg

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html                      ]



