JJ wrote: > Hi, all! > > Regarding the following warning type... > > warning: dereferencing type-punned pointer will break strict-aliasing rules > > Ex1: object_array list; > thing_array *things; > -thing_array = (thing_array *)&list; > +thing_array *things = (thing_array *)(void *)&list; > > Ex2: char_array audience; > thing_array var_list; > var_list = (thing_array&)audience; > > - From google'ing I found the work-a-round for Ex1 to remove the above > warning, Removing the warning won't solve your problem: it's a real bug and may well cause your program to crash or worse. > however I am having a hard time understanding how it relates to > Ex2? Any help would be appreciated. It is legacy code that I am > attempting to fix. It's really hard to know because we don't know what the code does. In general the rule is this: don't cast a pointer to type X to a pointer to incompatible type Y. In practice there is never a need to do this, but precisely how you fix it depends on the specific program. Andrew.