[OpenIndiana-discuss] weird C++ problem

James Carlson carlsonj at workingcode.com
Mon Apr 1 18:41:36 UTC 2013


On 04/01/13 14:29, Apostolos Syropoulos wrote:
> Hello everybody,
> 
> I was trying to compile a program and one file failed to compile
> with g++ 4.7.2 but it compiles with CC: Sun C++ 5.12 SunOS_i386 2011/11/16.

The real question here might be why Sun's compiler doesn't gag.

> using namespace std;
>     namespace KPS {
>         extern "C" {
>             #include <string.h> //it includes another header that eventually
>         }                       // included this header.
>     }

I think that begs a bit of a question: why would you want to include any
header file (even one in your own application) within a namespace {}
block?  That sounds to me like an open invitation to hard-to-understand
problems.

-- 
James Carlson         42.703N 71.076W         <carlsonj at workingcode.com>



More information about the OpenIndiana-discuss mailing list