[Haifux] Intermingled code and declarations and gcc

Orna Agmon Ben-Yehuda ladypine at gmail.com
Thu Sep 17 14:06:54 MSD 2009


Hi Eli,

Is this C? You are defining an array with an unknown length at compile
time. It won't work anyhow, no matter what the value of the length var
is. You need a malloc there.

Unless this is C++ with some overriding?

Orna.

On Thu, Sep 17, 2009 at 1:51 PM, Eli Billauer <eli at billauer.co.il> wrote:
> Hello,
>
>
> I'm trying to compile some code using gcc 2.96 (gcc 3.0.4 gets crazy on
> some other issue. Haven't tried on gcc 4 yet, but that's a bit far
> fetched right now).
>
>
> The offending rows are more or less (edited a bit for clarity):
>
>
>    /* count number of environment variables currently set */
>
>    unsigned int envar_count;
>
>    for (envar_count=0; envp[envar_count] != NULL; envar_count++);
>
>    char *child_envp[envar_count];
>
>
> Apparent problem: The compiler doesn't like the char declaration
> following "real" code. Can't move the declaration before it, because the
> array's size depends on the result of the code.
>
>
> I would be so happy if someone popped up and said, "just use the
> -something flag".
>
>
> Anyone?
>
>
> Shana Tova,
>
>    Eli
>
> --
> Web: http://www.billauer.co.il
>
> _______________________________________________
> Haifux mailing list
> Haifux at haifux.org
> http://hamakor.org.il/cgi-bin/mailman/listinfo/haifux
>



More information about the Haifux mailing list