🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c++
Article #309

Re: constant expressions

#309
From: Doug Gwyn
Date: Tue, 14 Aug 1990 16:44
11 lines
1095 bytes
In article <1916@tkou02.enet.dec.com> diamond@tkou02.enet.dec.com (diamond@tkovoa) writes:
>In article <5930@darkstar.ucsc.edu> daniel@terra.ucsc.edu () writes:
>>Should a translator identify 1-1 as ``a constant expression evaluating
>>to zero,'' (even absent optimization)?
>I have added comp.std.c to the distribution for this article, because
>the C standard is almost vague on this as well.

The C standard is not at all vague about this; see section 3.4.
"1-1" is definitely an integral constant expression with value zero.
It may be used any place that the integral constant "0" could be used,
including in constructing a null pointer constant (see section 3.2.2.3).
Technical Details
Message-ID: <13550@smoke.BRL.MIL>
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!cs.utexas.edu!yale!cmcl2!adm!smoke!gwyn
References: <5930@darkstar.ucsc.edu> <1916@tkou02.enet.dec.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!cs.utexas.edu!yale!cmcl2!adm!smoke!gwyn
From: gwyn@smoke.BRL.MIL (Doug Gwyn)
Newsgroups: comp.std.c++,comp.std.c
Subject: Re: constant expressions
Message-ID: <13550@smoke.BRL.MIL>
Date: 14 Aug 90 16:44:26 GMT
References: <5930@darkstar.ucsc.edu> <1916@tkou02.enet.dec.com>
Followup-To: comp.std.c++
Organization: U.S. Army Ballistic Research Laboratory, APG, MD.
Lines: 11