Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!uunet!aplcen!haven!adm!smoke!gwyn From: gwyn@smoke.BRL.MIL (Doug Gwyn) Newsgroups: comp.std.c Subject: Re: Casting pointers Keywords: Pointers, casting Message-ID: <13980@smoke.BRL.MIL> Date: 1 Oct 90 02:12:39 GMT References: <1990Sep29.201144.23113@maths.tcd.ie> Organization: U.S. Army Ballistic Research Laboratory, APG, MD. Lines: 13 In article <1990Sep29.201144.23113@maths.tcd.ie> tim@maths.tcd.ie (Timothy Murphy) writes: >when temporarily 'borrowing' od from Unix to Mac. Assuming you're talking about AT&T's proprietary source code, that is not "borrowing", it's theft. >char *buf = "abc"; > int *n = (int*) buf; >Should this always work? Of course not. You may cast pointers to objects with more stringent alignment requirements to pointers to objects having less stringent or the same alignment requirements, not the other way around.