[OpenIndiana-discuss] weird C++ problem

Apostolos Syropoulos asyropoulos at yahoo.com
Mon Apr 1 19:03:17 UTC 2013


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

I have no idea!


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

Removing the namesace definition in the simple example solves the problem but 

when applying this solution to the real file, the compiler complains about
many other things. The only way to compile the original file is to put00

the following lines at the beginning of the input file:


#undef __cplusplus
#define __cplusplus 1

A.S.


----------------------
Apostolos Syropoulos
Xanthi, Greece




>________________________________
> From: James Carlson <carlsonj at workingcode.com>
>To: openindiana-discuss at openindiana.org 
>Sent: Monday, April 1, 2013 9:41 PM
>Subject: Re: [OpenIndiana-discuss] weird C++ problem
> 
>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.

>> 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>
>
>_______________________________________________
>OpenIndiana-discuss mailing list
>OpenIndiana-discuss at openindiana.org
>http://openindiana.org/mailman/listinfo/openindiana-discuss
>
>
> 



More information about the OpenIndiana-discuss mailing list