🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #412

Re: (char *)(-1)

#412
From: Alan J Rosenthal
Date: Fri, 04 Aug 1989 16:21
12 lines
917 bytes
pardo@june.cs.washington.edu (David Keppel) writes:
>    char const magic_1 = 'j';
>    static char const terminator[] = "unk";
>    #define MAGIC_1 (&magic_1)
>
>Then  `return (MAGIC_1);'.  *If* the implementation gives you
>contiguous layout, then dereferencing `MAGIC_1' will give you `junk'...

Of course, there is a way to request contiguous layout in C:
    char magic_1[] = "junk";
    #define MAGIC_1 magic_1
Technical Details
Message-ID: <1989Aug4.122059.22859@jarvis.csri.toronto.edu>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!dgp.toronto.edu!flaps
References: <GEOFF.89Jun11231924@onyx.cs.warwick.ac.uk> <2619@yunexus.UUCP> <388@celit.UUCP> <118@psitech.UUCP> <1063@tukki.jyu.fi> <1282@cbnewsl.ATT.COM> <617@prles2.UUCP> <8872@june.cs.washington.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!dgp.toronto.edu!flaps
Newsgroups: comp.std.c
From: flaps@dgp.toronto.edu (Alan J Rosenthal)
Subject: Re: (char *)(-1)
Message-ID: <1989Aug4.122059.22859@jarvis.csri.toronto.edu>
Keywords: pointers, casts
References: <GEOFF.89Jun11231924@onyx.cs.warwick.ac.uk> <2619@yunexus.UUCP> <388@celit.UUCP> <118@psitech.UUCP> <1063@tukki.jyu.fi> <1282@cbnewsl.ATT.COM> <617@prles2.UUCP> <8872@june.cs.washington.edu>
Date: 4 Aug 89 16:21:00 GMT