🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #3632

Re: Wishful thinking: return-parameter

#3632
From: Stephen Baynes
Date: Thu, 03 Aug 1995 07:19
39 lines
1670 bytes
Zefram (A.Main@dcs.warwick.ac.uk) wrote:
: Markus Freericks <mfx@cs.tu-berlin.de> wrote:
: [...]

: I'm afraid it does.  I think that

: int main()
: {
:  int x = 0, y;
:  (x,y) = 3;
:  return 0;
: }

: is a strictly conforming program, having the effect of assigning the
: value 3 to y.  Not having a copy of the standard, I'm not absolutely
: certain that the result of the comma operator can be an lvalue.  (gcc
: groks it, but that's irrelevant.)

Its not conforming.
You are need to do something like:

int main()
{
:  int x = 0, y;
  *(&x,&y) = 3;
  return 0;
}

On the other hand in your example the use of the comman operator is in a 
syntactically valid expression - the error is in the semantics. This will 
make it very difficult to parse as anything else, such as a compound 
assignment, so your point is valid.
is valid.

--
Stephen Baynes                              baynes@mulsoc2.serigate.philips.nl
Philips Semiconductors Ltd
Southampton                                 My views are my own.
United Kingdom
Technical Details
Message-ID: <DCq4CI.KxB@ukpsshp1.serigate.philips.nl>
Path: arc1-ca.pugleaf.net!phcoms4.seri.philips.nl!panther!baynes
References: <3ver2u$8bk@caip.rutgers.edu> <3vhf7k$lo8@mujibur.inmind.com> <DCL2LC.GBK@proteon.com> <3viv5u$bkv@news.cs.tu-berlin.de> <1995Aug2.015211.11775@dcs.warwick.ac.uk>

Show Full Headers
Complete Article Headers
Newsgroups: comp.std.c
Path: arc1-ca.pugleaf.net!phcoms4.seri.philips.nl!panther!baynes
From: baynes@ukpsshp1.serigate.philips.nl (Stephen Baynes)
Subject: Re: Wishful thinking: return-parameter
Sender: news@ukpsshp1.serigate.philips.nl (account for localnews)
Message-ID: <DCq4CI.KxB@ukpsshp1.serigate.philips.nl>
Date: Thu, 3 Aug 1995 07:19:30 GMT
References: <3ver2u$8bk@caip.rutgers.edu> <3vhf7k$lo8@mujibur.inmind.com> <DCL2LC.GBK@proteon.com> <3viv5u$bkv@news.cs.tu-berlin.de> <1995Aug2.015211.11775@dcs.warwick.ac.uk>
Organization: Philips Semiconductors, Southampton, UK
X-Newsreader: TIN [version 1.2 PL2]