[Haifux] Intermingled code and declarations and gcc

Eli Billauer eli at billauer.co.il
Thu Sep 17 14:51:50 MSD 2009


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




More information about the Haifux mailing list