🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #4078

Re: Function-prototype scope: Why?

#4078
From: Stan Ryckman
Date: Fri, 22 Sep 1995 17:41
30 lines
1558 bytes
In article <MEISSNER.95Sep22121246@tiktok.cygnus.com>,
Michael Meissner <meissner@cygnus.com> wrote:
|In article <43s7k4$j2v@gatekeeper.atml.co.uk> jrr@atml.co.uk (John Rickard) writes:
|
|| Stan Ryckman (sgr@ae-sun01.alden.com) wrote:
|| : All pointers-to-struct must have the same "shape"
|| 
|| Is that so?  I've often written code that makes that assumption, but I
|| can't find any justification for it in the standard.  Can you give
|| references?
|
|Because if they didn't, then you couldn't reliably write code that uses:
|
|	struct unknown_in_this_module *ptr
|
|as an opaque pointer.

I think you actually could as long as size was the same.  A bizarre
implementation could use machine address for all struct pointers
except those whose first element is of type char, and reverse
all the bits on those pointers.  All opaque treatments would work.

The problem would occur when casting the "opaque" pointer to a
specific struct pointer for actual use.

Cheers,
Stan.
-- 
HELP!  I'M BEING HELD PRISONER IN A .SIGNATURE FACTORY!
    Stan Ryckman   sgr@alden.com
Technical Details
Message-ID: <43usga$go2@ae-sun01.alden.com>
Path: arc1-ca.pugleaf.net!alden.com!not-for-mail
References: <43cgmb$cec@news0.rain.rg.net> <43qod5$clf@ae-sun01.alden.com> <43s7k4$j2v@gatekeeper.atml.co.uk> <MEISSNER.95Sep22121246@tiktok.cygnus.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!alden.com!not-for-mail
From: sgr@ae-sun01.alden.com (Stan Ryckman)
Newsgroups: comp.std.c
Subject: Re: Function-prototype scope: Why?
Date: 22 Sep 1995 13:41:30 -0400
Organization: Amber & Sneakers Fan Club
Message-ID: <43usga$go2@ae-sun01.alden.com>
References: <43cgmb$cec@news0.rain.rg.net> <43qod5$clf@ae-sun01.alden.com> <43s7k4$j2v@gatekeeper.atml.co.uk> <MEISSNER.95Sep22121246@tiktok.cygnus.com>
NNTP-Posting-Host: ae-sun01.alden.com