Thread: ecpg c++ scope operator lost

ecpg c++ scope operator lost

From
Mark Pether
Date:
Ecpg pretty prints my code causing compile errors.

ie. code to compile:

EXEC SQL BEGIN DECLARE SECTION;
        char bound_waiting_state =
            static_cast<char>(Processor::waiting);
EXEC SQL END DECLARE SECTION;

turns into:

 /* exec sql begin declare section */
#line 90 "Schedule.pgcc"
   char  bound_waiting_state  = static_cast < char > ( Processor : :
waiting ) ;
/* exec sql end declare section */
#line 93 "Schedule.pgcc"

The scope operator becomes space padded and compiler barfs.

Work around is to initialise variables outside of declare section.

Regards,
Mark Pether.

Re: ecpg c++ scope operator lost

From
Michael Meskes
Date:
On Wed, Dec 17, 2003 at 03:14:31PM -0500, Mark Pether wrote:
> Ecpg pretty prints my code causing compile errors.

Please note that ecpg is a precompiler for embedded SQL in C not C++.

Michael
--
Michael Meskes
Email: Michael at Fam-Meskes dot De
ICQ: 179140304, AIM/Yahoo: michaelmeskes, Jabber: meskes@jabber.org
Go SF 49ers! Go Rhein Fire! Use Debian GNU/Linux! Use PostgreSQL!

Re: ecpg c++ scope operator lost

From
Mark Pether
Date:
If that's the case then you'd better change your documentation...


PostgreSQL 7.3 Documentation

Chapter 4. ECPG - Embedded SQL in C
This chapter describes the embedded SQL package for PostgreSQL. It works
with C and *C++.* It was written by Linus Tolke (<linus@epact.se
<mailto:linus@epact.se>>) and Michael Meskes (<meskes@postgresql.org
<mailto:meskes@postgresql.org>>).


Regards,
Mark Pether.


Michael Meskes wrote:

>On Wed, Dec 17, 2003 at 03:14:31PM -0500, Mark Pether wrote:
>
>
>>Ecpg pretty prints my code causing compile errors.
>>
>>
>
>Please note that ecpg is a precompiler for embedded SQL in C not C++.
>
>Michael
>
>

Re: ecpg c++ scope operator lost

From
Michael Meskes
Date:
On Mon, Dec 22, 2003 at 09:33:00AM -0500, Mark Pether wrote:
> If that's the case then you'd better change your documentation...
>
>
> PostgreSQL 7.3 Documentation
>
> Chapter 4. ECPG - Embedded SQL in C
> This chapter describes the embedded SQL package for PostgreSQL. It works
> with C and *C++.* It was written by Linus Tolke (<linus@epact.se
> ...
> >Please note that ecpg is a precompiler for embedded SQL in C not C++.

Sorry, I didn't know the docs say that. Actually we did add some C++
stuff, so if you can send me a list of what doesn't work I will add this
to the ecpg todo list, but I wouldn't say we guarantee that all C++
constructs work with ecpg.

Michael
--
Michael Meskes
Email: Michael at Fam-Meskes dot De
ICQ: 179140304, AIM/Yahoo: michaelmeskes, Jabber: meskes@jabber.org
Go SF 49ers! Go Rhein Fire! Use Debian GNU/Linux! Use PostgreSQL!

Re: ecpg c++ scope operator lost

From
Michael Meskes
Date:
On Mon, Dec 22, 2003 at 09:33:00AM -0500, Mark Pether wrote:
> If that's the case then you'd better change your documentation...

Fixed. Thanks for pointing me to this.

Michael
--
Michael Meskes
Email: Michael at Fam-Meskes dot De
ICQ: 179140304, AIM/Yahoo: michaelmeskes, Jabber: meskes@jabber.org
Go SF 49ers! Go Rhein Fire! Use Debian GNU/Linux! Use PostgreSQL!