Boost logo

Boost :

From: Paul A. Bristow (boost_at_[hidden])
Date: 2002-10-24 15:53:57


I thought I might get a Boost about this :-( - but do you have any other
suggestion for how to provide an alias without duplicating code (may be const
double pi and/or a double pi() function so not so simple?

Paul

> -----Original Message-----
> From: boost-bounces_at_[hidden]
> [mailto:boost-bounces_at_[hidden]]On Behalf Of Fernando Cacciola
> (Office)
> Sent: Thursday, October 24, 2002 6:46 PM
> To: Boost mailing list
> Subject: Re: [boost] two_pi or pi_twice?
>
>
>
> ----- Original Message -----
> From: "Paul A. Bristow" <boost_at_[hidden]>
> To: "Boost mailing list" <boost_at_[hidden]>
> Sent: Thursday, October 24, 2002 1:02 PM
> Subject: RE: [boost] two_pi or pi_twice?
>
>
> > Is
> >
> > #define two_pi pi_twice
> >
> > the best way to provide two_pi in addition to pi_twice?
> >
> I'd say it is the worst way to do it (no pun intended).
>
> // my scope
> double pi_twice () { return 2 * M_PI ; }
>
> void foo()
> {
> // my local variable
> double two_pi = pi_twice() ;
>
> // ERROR: the compiler actually sees: double pi_twice = pi_twice() ; which
> is ill-formed
> }
>
> NEVER USE A MACRO TO ALIAS AN IDENTIFIER.
>
>
> Fernando Cacciola
>
>
> _______________________________________________
> Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
>


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk