Jeroen Demeyer on Fri, 10 Jul 2015 14:24:01 +0200


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: gp2c segfault


On 2015-07-10 13:51, Bill Allombert wrote:
The same variable, or two variables with the same name ?
I really mean the same variable (I don't see how "two variables with the same name" could ever make sense), just declared global() twice.

You cannot expect to get good results with GP2C if you use global
variables, unless you are very careful to treat them as read only
after initialization and use clone().
...or unless they are "small" ("long" in C). Those should be safe, right?

So I would suggest you start by cleaning your code.
Of course.

But in C, it's legal to write
  static long x;
  static long x;
so it would be convenient if
  global(x:small);
  global(x:small);
would generate that (instead of a "static void x" on the first line, what it currently does).

Cheers,
Jeroen.