[Freeciv-Dev] (PR#15126) patch: fc_free macro
[Top] [All Lists]
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
 
<URL: http://bugs.freeciv.org/Ticket/Display.html?id=15126 >
> [jdorje - Di 10. Jan 2006, 19:00:23]:
> 
> Such a macro violates the rules of function-looking macros.  That is, it 
> looks like a function but it behaves as no function ever could.
> 
> If we have it (code like this is used in several places) it should be 
> FC_FREE().
> 
> -jason
> 
The macro in gui-sdl/gui_mem.h is actually
#define FREE(ptr) do { if (ptr) free(ptr); ptr = NULL; } while(0)
So as I now understand the do {} while(0) construct is just to make it
not look like a function and thus the macro in utility/mem.h should be
#define FC_FREE(ptr) do { free(ptr); ptr = NULL; } while(0)
correct?
 
- [Freeciv-Dev] Re: (PR#15126) patch: fc_free macro, Jason Short, 2006/01/10
- [Freeciv-Dev] (PR#15126) patch: fc_free macro,
Christian Prochaska <=
 
- [Freeciv-Dev] Re: (PR#15126) patch: fc_free macro, Jason Short, 2006/01/10
- [Freeciv-Dev] (PR#15126) patch: fc_free macro, Christian Prochaska, 2006/01/10
 
- [Freeciv-Dev] Re: (PR#15126) patch: fc_free macro, Jason Short, 2006/01/10
- [Freeciv-Dev] (PR#15126) patch: fc_free macro, Christian Prochaska, 2006/01/11
 
- [Freeciv-Dev] Re: (PR#15126) patch: fc_free macro, Jason Short, 2006/01/11
 - [Freeciv-Dev] (PR#15126) patch: fc_free macro, Christian Prochaska, 2006/01/11
 
- [Freeciv-Dev] Re: (PR#15126) patch: fc_free macro, Jason Short, 2006/01/11
 - [Freeciv-Dev] (PR#15126) patch: fc_free macro, Christian Prochaska, 2006/01/11
 
  
  
 
 
 
 
 | 
 |