help with type-punned warning please
From: David Ford (david+challenge-response_at_blue-labs.org)
Date: 02/26/04
- Next message: pillip: "Re: need some help with arrays"
- Previous message: E. Robert Tisdale: "Re: Efficiency of math.h"
- Next in thread: Martin Ambuhl: "Re: help with type-punned warning please"
- Reply: Martin Ambuhl: "Re: help with type-punned warning please"
- Reply: Vijay Kumar R Zanvar: "Re: help with type-punned warning please"
- Reply: David Ford: "Re: help with type-punned warning please"
- Reply: Chris Torek: "Re: help with type-punned warning please"
- Reply: Arthur J. O'Dwyer: "Re: help with type-punned warning please"
- Reply: E. Robert Tisdale: "Re: help with type-punned warning please"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 25 Feb 2004 23:59:48 -0500 To: "David Ford" <david+challenge-response@blue-labs.org>
I have a macro that I use across the board for freeing ram. I'd like to
clean up my code so I don't get these warnings.
#define sfree(x) _internal_sfree((void **)&x)
#define _internal_sfree(x) ({ if(x && *x) { free(*x); *x=NULL; } })
void somefunction() {
char *x = malloc(10);
int *y = malloc(10);
sfree(x);
sfree(y);
}
results in:
warning: dereferencing type-punned pointer will break strict-aliasing
rules
What's the best way of fixing my lack of clue?
Thank you,
David
- Next message: pillip: "Re: need some help with arrays"
- Previous message: E. Robert Tisdale: "Re: Efficiency of math.h"
- Next in thread: Martin Ambuhl: "Re: help with type-punned warning please"
- Reply: Martin Ambuhl: "Re: help with type-punned warning please"
- Reply: Vijay Kumar R Zanvar: "Re: help with type-punned warning please"
- Reply: David Ford: "Re: help with type-punned warning please"
- Reply: Chris Torek: "Re: help with type-punned warning please"
- Reply: Arthur J. O'Dwyer: "Re: help with type-punned warning please"
- Reply: E. Robert Tisdale: "Re: help with type-punned warning please"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|