This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
does this code break the strict-aliasing rules ?
- From: Michael Haubenwallner <michael dot haubenwallner at salomon dot at>
- To: gcc-help at gcc dot gnu dot org
- Date: Tue, 06 Feb 2007 16:58:14 +0100
- Subject: does this code break the strict-aliasing rules ?
Hi,
encountering strange results, I'm unsure whether this code is affected
by strict-aliasing rules:
static void *CreateRes(PrexecTresource eRes, void *pvVal)
{
switch(eRes) {
case PrexecNprintCommand:
case PrexecNoptHost:
case PrexecNoptHostString:
case PrexecNoptDest:
case PrexecNoptDestString:
case PrexecNoptFileString:
if (pvVal != NULL) {
pvVal = (void*)strdup((char*)pvVal);
}
break;
default:
break;
}
return pvVal;
}
Specifically the casts around the 'strdup'...
Thanks,
/haubi/