🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #1763

Re: Casting pointers

#1763
From: Doug Gwyn
Date: Mon, 01 Oct 1990 02:12
13 lines
947 bytes
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.
Technical Details
Message-ID: <13980@smoke.BRL.MIL>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!uunet!aplcen!haven!adm!smoke!gwyn
References: <1990Sep29.201144.23113@maths.tcd.ie>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!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