Boost logo

Boost :

From: Julius Muschaweck (muschaweck_at_[hidden])
Date: 2003-02-03 08:56:31

Hi Kresimir, hi Joerg,

At 11:41 03.02.2003, you wrote:

>Hi Joerg, hi Julius,
>I am not sure whether the message
>from comp.lang.c++.moderated is on topic ;o),
>but maybe it is worth a look.

Thanks. The message is exactly on topic. The author presents a nice program
that determines the availability of abs overloads, and a reply to this
message explains that

         In math.h, the section about abs() and fabs() overloads is
#ifdefed by _MSC_EXTENSIONS. That is, they
         exist ONLY >in strict mode. If you disable language extensions,
your code shows that
         the MS VC++ 7 is standard compliant in the sense of abs/fabs

I checked that with .NET, and he is right. With /Za (disable language
extensions), double abs(double) and the whole load of float sin(float) etc.
is indeed declared and ublas::type_traits<double> works also with .NET.
But .NET with /Za is not exactly what I think most people want. For
example, you can't even define private member functions with private return
values outside of the class definition. Look at the following lines which
are copied and pasted from the Standard, clause 11:

         class A {
                 typedef int I; // private member
                 I f();
                 friend I g(I);
                 static I x;

         A::I A::f() { return 0; }
         A::I g(A::I p = A::x);
         A::I g(A::I p) { return 0; }
         A::I A::x = 0;

         Here, all the uses of A::I are well-formed because A::f and A::x
are members of class A and g is a
         friend of class A. This implies, for example, that access checking
on the first use of A::I must be deferred
         until it is determined that this use of A::I is as the return type
of a member of class A.

VC. NET with /Za complains that I cannot use A::I etc because it's private.

Back to the BOOST_NO_STDC_NAMESPACE issue:
Only if /Za is set and thus _MSC_EXTENSIONS is undefined, then VC .NET
seems to have all declarations for the math function overloads properly.
Maybe you could make the #define of BOOST_NO_STDC_NAMESPACE for VC .NET
depend on the _MSC_EXTENSIONS switch: If _MSC_EXTENSIONS is defined, the
math function overloads are missing and BOOST_NO_STDC_NAMESPACE should be


Julius Muschaweck

Paul-Gerhardt-Allee 42
81245 Muenchen, Germany

Phone: +49 89 820050-30
Fax: +49 89 820050-41
e-mail: <muschaweck_at_[hidden]>

Boost list run by bdawes at, gregod at, cpdaniel at, john at