*BSD News Article 78224


Return to BSD News archive

Path: euryale.cc.adfa.oz.au!newshost.carno.net.au!harbinger.cc.monash.edu.au!munnari.OZ.AU!metro!metro!asstdc.scgt.oz.au!nsw.news.telstra.net!act.news.telstra.net!psgrain!usenet.eel.ufl.edu!news.mathworks.com!news-peer.gsl.net!news.gsl.net!swrinde!howland.erols.net!EU.net!usenet2.news.uk.psi.net!uknet!usenet1.news.uk.psi.net!uknet!dispatch.news.demon.net!demon!awfulhak.demon.co.uk!awfulhak.demon.co.uk!awfulhak.demon.co.uk!not-for-mail
From: brian@awfulhak.demon.co.uk (Brian Somers)
Newsgroups: comp.unix.bsd.freebsd.misc,gnu.g++.help
Subject: Re: g++2.7.2 error on freebsd
Followup-To: comp.unix.bsd.freebsd.misc,gnu.g++.help
Date: 12 Sep 1996 10:05:06 +0100
Organization: Coverform Ltd.
Lines: 28
Message-ID: <518jo2$92@anorak.coverform.lan>
References: <8414360547401@maverick.mcs.anl.gov> <uloeheimy.fsf@ppe.bb-data.de>
NNTP-Posting-Host: localhost.coverform.lan
X-NNTP-Posting-Host: awfulhak.demon.co.uk
X-Newsreader: TIN [version 1.2 PL2]
Xref: euryale.cc.adfa.oz.au comp.unix.bsd.freebsd.misc:27202 gnu.g++.help:13311

mib@ppe.bb-data.de wrote:
: brian@awfulhak.demon.co.uk (Brian Somers) writes:
: > : :   if( fp = fopen( "x", "w" ), !fp )
: > :     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
: > 
: > : ARGHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH! :-)
: > 
: > Pardon ?

: That seems like a comment on that rather baroque coding style. :-) It
: is certainly not the most obvious way of saying

:         if( !(fp=fopen("x", "w")) )

Hmm, I ended up doing this because I needed my code to compile on stupid
DOS compilers that warn about

    if( fp = fopen( "x", "w" ) )
    {
	....
	fclose( fp );
    }

I like it :)

--
Brian <brian@awfulhak.demon.co.uk>
Don't _EVER_ lose your sense of humour....