Boost logo

Boost :

From: Fernando Cacciola \(Office\) (fcacciola_at_[hidden])
Date: 2002-10-24 12:46:25


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


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