🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.g++.lib.bug
Article #547

Possible bug in <assert.h> (version 1.36.1)

#547
From: Doug Lea
Date: Fri, 29 Dec 1989 14:56
24 lines
1213 bytes
Sorry for the delayed reply -- I've been away.

Well, it's less of a bug than a limitation: if you were to change assertval
from

    #define assertval(ex) \
            ((ex) ? 1 : \
                  (__eprintf("Failed assertion " #ex " at line %d of `%s'.\n",\
                   __LINE__, __FILE__), abort (), 0))

to

    #define assertval(ex) \
            ((ex) ? (ex) : \
                  (__eprintf("Failed assertion " #ex " at line %d of `%s'.\n",\
                   __LINE__, __FILE__), abort (), 0))


then it would evaluate ex twice. While it IS possible to overcome
this with gcc/g++ expression-returning compound statements, I didn't
do this, in order to be conservative. Do thing it is worth doing?

-Doug
Technical Details
Message-ID: <8912291456.AA18748@g.oswego.edu>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!G.OSWEGO.EDU!dl
References: <8912201451.AA16126@idris.id.dk>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!G.OSWEGO.EDU!dl
From: dl@G.OSWEGO.EDU (Doug Lea)
Newsgroups: gnu.g++.lib.bug
Subject: Possible bug in <assert.h> (version 1.36.1)
Message-ID: <8912291456.AA18748@g.oswego.edu>
Date: 29 Dec 89 14:56:49 GMT
References: <8912201451.AA16126@idris.id.dk>
Sender: daemon@tut.cis.ohio-state.edu
Reply-To: dl@oswego.oswego.edu
Distribution: gnu
Organization: GNUs Not Usenet
Lines: 24