|
From: Larry D. <ldo...@re...> - 2008-04-28 22:28:34
|
On Mon, Apr 28, 2008 at 02:24:14PM -0700, Stephen Williams wrote:
> Larry Doolittle wrote:
> | static char error_code[]="";
> | info->code = error_code;
> |
> | static char *error_code=NULL;
> | if (error_code == NULL) error_code=strdup("");
> | info->code = error_code;
> |
> | info->code = strdup("");
>
> #3 is clearly out.
>
> I perfer #1, personally. Is dmalloc/efence really going to be
> somehow confused by #1, and will #2 really trigger them to do
> anything special?
Dmalloc/efence won't touch #1, so if the VPI program tries
to clobber or over-read the error code, they can't complain,
and some pseudo-random internal Icarus memory will get abused.
efence can detect those problems if #2 is used.
After correcting for the amazing delay of this mailing list,
I take this as a vote for #4, since it is essentially #1
but shrunk to a single line:
info->code = (char *) "";
Unless some currently used compiler complains about it.
- Larry
|