Date: Thu, 5 Oct 2000 08:05:07 +0200 (IST) From: Eli Zaretskii X-Sender: eliz AT is To: Michael Powe cc: djgpp AT delorie DOT com Subject: Re: problem with math.h In-Reply-To: <39DC061F.97DFBB0D@trollope.org> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Reply-To: djgpp AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk On Wed, 4 Oct 2000, Michael Powe wrote: > gcc -Wall -ansi -pedantic ... -lm > > results in an error that `PI' is undeclared. This is the expected behavior. > Looking in math.h, I see that the section in which PI is #defined is > preceded by #ifndef __STRICT_ANSI__ and #ifndef _POSIX_SOURCE. > > Does ANSI C exclude a value for PI? Yes, the ANSI Standard does not define any macro to get the value of Pi. Since PI and M_PI pollute the namespace (they do not begin with an underscore), they are made invisible with -ansi. Portable programs which comply to ANSI C should provide their own definitions of Pi. You could simply copy the value from math.h.