Re: BUG #8608: ECPG: sizeof() in EXEC SQL DECLARE SECTION

From: Boszormenyi Zoltan <zb(at)cybertec(dot)at>
To: Michael Meskes <meskes(at)postgresql(dot)org>, alexsav23(at)gmail(dot)com
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #8608: ECPG: sizeof() in EXEC SQL DECLARE SECTION
Date: 2013-11-24 14:59:40
Message-ID: 5292145C.5000508@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

2013-11-24 12:55 keltezéssel, Michael Meskes írta:
> On Tue, Nov 19, 2013 at 10:39:48PM +0000, alexsav23(at)gmail(dot)com wrote:
>> d:\>"c:\Program Files\PostgreSQL\9.3\bin\ecpg.exe"-o 1.c 1.pgc
>> 1.pgc: 4: ERROR: syntax error at or near "("
>> error deleting output file "1.c"
> And another patch to try. Please send me feedback.

I think it's needlessly narrows the scope of the problem.
Consider this code:

#include <stdio.h>

#define hide_size_of_var sizeof

int main(void) {
int a[hide_size_of_var(int)];
int i;

for (i = 0; i < hide_size_of_var(int); i++) {
a[i] = i*3;
printf("i: %d a[i]: %d\n", i, a[i]);
}

return 0;
}

It compiles just fine in a C compiler and runs from 0 to 3 as expected.
GCC 4.8.2 doesn't say anything about it with -Wall.

I think you should pass everything through as is inside the '[' and ']' and
let the C compiler fail if the code is not valid.

Best regards,
Zoltán Böszörményi

>
> Michael
>
>

--
----------------------------------
Zoltán Böszörményi
Cybertec Schönig & Schönig GmbH
Gröhrmühlgasse 26
A-2700 Wiener Neustadt, Austria
Web: http://www.postgresql-support.de
http://www.postgresql.at/

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2013-11-24 16:09:57 Re: BUG #8611: ECPG: unclosed comment "/*"
Previous Message Michael Meskes 2013-11-24 11:55:17 Re: BUG #8608: ECPG: sizeof() in EXEC SQL DECLARE SECTION