🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.help
Article #49512

Re: passing constants by pointer

#49512
From: bob pasker
Date: Thu, 20 Jan 1994 02:57
28 lines
1304 bytes
In article <rbp-190194182522@tonto-slip13.cis.brown.edu>, rbp@brown.edu
(bob pasker) wrote:

> my  VAX C compiler allows me to pass a constant by reference as follows:
> 
>                foo(&1)
> 
> but GCC gives me an "invalid lvalue". 
> 
> does anyone know the proper incantation?

i've been informed by private e-mail that C cannot do this.

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."

-- 
-- bob pasker
-- brown u., dept. of history
-- rbp@brown.edu
--
Technical Details
Message-ID: <rbp-190194215745@tonto-slip5.cis.brown.edu>
Path: arc1-ca.pugleaf.net!gmd.de!newsserver.jvnc.net!darwin.sura.net!howland.reston.ans.net!agate!news.Brown.EDU!tonto-slip5.cis.brown.edu!user
References: <rbp-190194182522@tonto-slip13.cis.brown.edu>

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 04:04:23 PST
Path: arc1-ca.pugleaf.net!gmd.de!newsserver.jvnc.net!darwin.sura.net!howland.reston.ans.net!agate!news.Brown.EDU!tonto-slip5.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: Wed, 19 Jan 1994 21:57:45 -0500
Organization: brown university
Lines: 28
Message-ID: <rbp-190194215745@tonto-slip5.cis.brown.edu>
References: <rbp-190194182522@tonto-slip13.cis.brown.edu>
NNTP-Posting-Host: tonto-slip5.cis.brown.edu