🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.help
Article #49519

Re: passing constants by pointer

#49519
From: bob pasker
Date: Thu, 20 Jan 1994 16:01
32 lines
1494 bytes
In article <HERING.94Jan20100654@deneb.rtp.dg.com>, hering@rtp.dg.com (Dean
Herington) wrote:

> In article <rbp-190194215745@tonto-slip5.cis.brown.edu> rbp@brown.edu (bob pasker) writes:
> 
>    i have created the following workaround:
> 
>    #define BYREF(c) ({int _bar=c; &_bar;})
> 
> 		   foo(BYREF(1));
> 
>    :-(
> 
>    luckily GNU cc allows these kind of "statements within expressions."
> 
> Yes, "statements within expressions" are supported, but in your
> example above aren't you passing to foo the address of a local
> variable that has already expired?  I doubt this is guaranteed to
> work.


dean is quite right.

maybe 

#define BYREF(c) ({static int _bar=c; &_bar;})

-- 
-- bob pasker
-- brown u., dept. of history
-- rbp@brown.edu
--
Technical Details
Message-ID: <rbp-200194110138@tonto-slip9.cis.brown.edu>
Path: arc1-ca.pugleaf.net!gmd.de!xlink.net!sol.ctr.columbia.edu!howland.reston.ans.net!agate!news.Brown.EDU!tonto-slip9.cis.brown.edu!user
References: <rbp-190194182522@tonto-slip13.cis.brown.edu> <HERING.94Jan20100654@deneb.rtp.dg.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 11318c,74f900c98fe29e8b
X-Google-Attributes: gid11318c,public
X-Google-ArrivalTime: 1994-01-20 14:29:09 PST
Path: arc1-ca.pugleaf.net!gmd.de!xlink.net!sol.ctr.columbia.edu!howland.reston.ans.net!agate!news.Brown.EDU!tonto-slip9.cis.brown.edu!user
From: rbp@brown.edu (bob pasker)
Newsgroups: gnu.gcc.help
Subject: Re: passing constants by pointer
Followup-To: gnu.gcc.help
Date: Thu, 20 Jan 1994 11:01:38 -0500
Organization: brown university
Lines: 32
Message-ID: <rbp-200194110138@tonto-slip9.cis.brown.edu>
References: <rbp-190194182522@tonto-slip13.cis.brown.edu> <HERING.94Jan20100654@deneb.rtp.dg.com>
NNTP-Posting-Host: tonto-slip9.cis.brown.edu