This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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!


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]