This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
do { .... } while 0;
- From: Erwin Ingris <erwiningris at yahoo dot com dot au>
- To: gcc at gcc dot gnu dot org
- Date: Fri, 12 Jul 2002 21:35:07 +1000 (EST)
- Subject: do { .... } while 0;
I often see code like this (genautomata.c) in gcc
sources.
#define VLA_PTR_CREATE(vla, allocated_length, name)
\
do
\
{
\
vla_ptr_t *vla_ptr = &(vla);
\
\
VARRAY_GENERIC_PTR_INIT (vla_ptr->varray,
allocated_length, name);\
vla_ptr->length = 0;
\
}
\
while (0)
Can someone tell what is advantage of putting this in
do .. while (0).What difference would it make if it
was just
#define VLA_PTR_CREATE(vla, allocated_length, name)
\
{
\
vla_ptr_t *vla_ptr = &(vla);
\
\
VARRAY_GENERIC_PTR_INIT (vla_ptr->varray,
allocated_length, name);\
vla_ptr->length = 0;
\
}
ERWIN.
http://www.sold.com.au - SOLD.com.au
- Find yourself a bargain!