🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #2107

Re: struct hack

#2107
From: Mark Brader
Date: Thu, 08 Oct 1992 17:41
19 lines
1574 bytes
> As has also been pointed out to me in email, I made a mistake at the
> end of my previous posting, which in fact negated most of my argument.
> 
> The expression f->s does not have type char*, it has type char[1].  It
> does not refer to the array returned by malloc, but simply to a small
> part of it, the part defined in the structure.

Hmm, I missed that too, but it doesn't affect anything.  The char * value
that we were both talking about is the one that f->s decays to as soon as
it's used in an appropriate context.  This, too, points to a single char,
but not because the member s has a length of 1; it's because a char *
only ever points to a single char.  p only points to a single char too.
p and the decayed f->s are interchangeable.
-- 
Mark Brader		 "... [A]toms and universes are the same.  All the
SoftQuad Inc., Toronto	      world is recursive, and that's why we never
utzoo!sq!msb, msb@sq.com      know where to begin."	-- Charles Goldfarb

This article is in the public domain.
Technical Details
Message-ID: <1992Oct8.174101.19668@sq.sq.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!mcsun!uknet!doc.ic.ac.uk!aixssc.uk.ibm.com!yktnews!admin!newsgate.watson.ibm.com!news.ans.net!europa.asd.contel.com!darwin.sura.net!zaphod.mps.ohio-state.edu!uunet.ca!wildcan!sq!msb
References: <KANZE.92Oct2210740@slsvdnt.us-es.sel.de> <1992Oct7.001450.16021@sq.sq.com> <KANZE.92Oct7212215@slsvdnt.us-es.sel.de>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!mcsun!uknet!doc.ic.ac.uk!aixssc.uk.ibm.com!yktnews!admin!newsgate.watson.ibm.com!news.ans.net!europa.asd.contel.com!darwin.sura.net!zaphod.mps.ohio-state.edu!uunet.ca!wildcan!sq!msb
From: msb@sq.sq.com (Mark Brader)
Newsgroups: comp.std.c
Subject: Re: struct hack
Message-ID: <1992Oct8.174101.19668@sq.sq.com>
Date: 8 Oct 92 17:41:01 GMT
References: <KANZE.92Oct2210740@slsvdnt.us-es.sel.de> <1992Oct7.001450.16021@sq.sq.com> <KANZE.92Oct7212215@slsvdnt.us-es.sel.de>
Organization: SoftQuad Inc., Toronto, Canada
Lines: 19