🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #3511

Re: Copy Files ???

#3511
From: Joe Keane
Date: Sat, 09 Dec 1995 07:50
19 lines
1224 bytes
In article <4a73am$jfu@newshost.lanl.gov>
Tanmoy Bhattacharya <tanmoy@qcd.lanl.gov> writes:
>`long *i;'
>(long*)(int*)(char*) i == i

No, it may not work.  What's the problem with that?

We've seen two examples of implementations where this won't work, which are
plausible if a bit unusual.  I'm sure that i could think of more examples.

The standard says that you can convert any object pointer to "void *" and back
and get the same pointer, and "char *" is grandfathered.  I don't see how this
implies that some round-about sequence of conversions is guaranteed to work.

In particular, i don't see why a "long *" is guaranteed to be a valid "int *".
It's often true, of course, but is there anything in the standard saying this?

--
Joe Keane, professional programmer
Technical Details
Message-ID: <jgkDJB73v.Lz2@netcom.com>
Path: arc1-ca.pugleaf.net!netcom.com!jgk
References: <46i39e$l6b@josie.abo.fi> <TANMOY.95Dec4230551@qcd.lanl.gov> <818294327snz@genesis.demon.co.uk> <4a73am$jfu@newshost.lanl.gov>

Show Full Headers
Complete Article Headers
Newsgroups: comp.std.c,comp.lang.c
Path: arc1-ca.pugleaf.net!netcom.com!jgk
From: Joe Keane <jgk@netcom.com>
Subject: Re: Copy Files ???
Message-ID: <jgkDJB73v.Lz2@netcom.com>
Summary: It's illegal.
Keywords: align
Sender: jgk@netcom18.netcom.com
Organization: none
References: <46i39e$l6b@josie.abo.fi> <TANMOY.95Dec4230551@qcd.lanl.gov> <818294327snz@genesis.demon.co.uk> <4a73am$jfu@newshost.lanl.gov>
Date: Sat, 9 Dec 1995 07:50:19 GMT