[Haifux] Intermingled code and declarations and gcc
vadim.eisenberg at gmail.com
Thu Sep 17 14:44:16 IDT 2009
Try -std=c99 flag. The C99 standard allows declarations everywhere.
From: haifux-bounces at haifux.org [mailto:haifux-bounces at haifux.org] On Behalf Of Eli Billauer
Sent: Thursday, September 17, 2009 1:52 PM
To: Haifa Linux Club
Subject: [Haifux] Intermingled code and declarations and gcc
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++);
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".
Haifux mailing list
Haifux at haifux.org
More information about the Haifux