This is the mail archive of the gcc-patches@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]

Re: [5/6] Preprocessor include


On Wed, Oct 31, 2018 at 12:24:44PM -0400, Nathan Sidwell wrote:
> On 10/31/18 11:44 AM, Marek Polacek wrote:
> 
> > > +  else if (to_free)
> > > +    free ((void *)to_free);
> > 
> > free (NULL) is ok so do you really need the check?
> 
> Probably not :)  IIRC the if (X) free (X) idiom was nearby, and I didn't
> feel like rocking that boat.

The if (x) free (x); idiom is useful if x is unlikely or very unlikely and
the cost of the function call is measureable.  But one should probably
use __builtin_expect in that case...

	Jakub


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