Re: extern "C" and #include

Lars wrote:

There are two files, bug4.pc and bug4.h. Here's bug4.pc:

	extern "C" {
	// include file defines TRUE and FALSE in an enum
	#include "bug4.h"

	  if (TRUE)
	    1 == 2;
	    1 == 3;

and here's bug4.h:

	typedef enum { FALSE = 0, TRUE = 1 } mybool;

When compiled, this produces the error message

	blackrabbit(46) % pc++ bug4.pc
	Error on line 8 of bug4.pc:  Undefined symbol 'TRUE'
	Error in pc++ while executing:
	------->  pC++2dep  TEMP_pC++.C

When I remove the 'extern "C"' wrapper, it compiles fine.  Both CC  
gcc compile the program w/o compile-time errors.  The extern C  
cannot easily be removed, as the include file is used with both C and
C++ and defines a lot of library functions written in C.

Fixed and CVS'ed. For future reference, below is a copy of my earlier  
message to Lars, which I forgot to CC to sage-bugs:

>we have this recurring problem throughout the parser, in that the  
>parser likes to treat a pair of curly braces { } as a new scope,  
>whereas with extern "C" {}, it obviously is not. This might be yet  
>another bug of this kind. 


It was indeed,                 --Beata