🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: net.lang.c++
Article #289

Declarations in statements -- a question.

#289
From: Stephen J. Muir
Date: Sun, 17 Aug 1986 02:19
20 lines
1033 bytes
Can anybody explain why the following fails to compile:

main ()
{	if (int i = 5)
		/* do something */;
}

when the following succeeds:

main ()
{	for (int i = 5; i; )
		/* do something */;
}

C++ version 1.1, BSD 4.2, DEC VAX-11/750.
-- 
EMAIL:	stephen@comp.lancs.ac.uk	| Post: University of Lancaster,
UUCP:	...!mcvax!ukc!dcl-cs!stephen	|	Department of Computing,
Phone:	+44 524 65201 Ext. 4120		|	Bailrigg, Lancaster, UK.
Project:Alvey ECLIPSE Distribution	|	LA1 4YR
Technical Details
Message-ID: <372@comp.lancs.ac.uk>
Path: arc1-ca.pugleaf.net!utzoo!mnetor!seismo!mcvax!ukc!dcl-cs!stephen

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: arc1-ca.pugleaf.net!utzoo!mnetor!seismo!mcvax!ukc!dcl-cs!stephen
From: stephen@comp.lancs.ac.uk (Stephen J. Muir)
Newsgroups: net.lang.c++
Subject: Declarations in statements -- a question.
Message-ID: <372@comp.lancs.ac.uk>
Date: Sat, 16-Aug-86 22:19:28 EDT
Article-I.D.: comp.372
Posted: Sat Aug 16 22:19:28 1986
Date-Received: Wed, 20-Aug-86 08:29:39 EDT
Reply-To: stephen@comp.lancs.ac.uk (Stephen J. Muir)
Organization: Department of Computing at Lancaster University, UK.
Lines: 20