This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Bad macros in gcc
- To: gcc at gcc dot gnu dot org
- Subject: Bad macros in gcc
- From: "H . J . Lu" <hjl at lucon dot org>
- Date: Wed, 11 Jul 2001 15:33:25 -0700
There are quie a few macros in gcc like
#define FOO(BAR) \
do \
{ \
int s;
for (s, ....) \
.. BAR... \
} \
while (0)
The problem is when you use FOO with
for (s = 0; s < 10; s++)
FOO (foo[s]);
gcc will build, but you will get random runtime errors. In glibc, we
always do
#define FOO(BAR) \
do \
{ \
int __s;
for (__s, ....) \
.. BAR... \
} \
while (0)
Shouldn't gcc do something like that or turn FOO into a function?
H.J.