comp.lang.ada
 help / color / mirror / Atom feed
From: Tanmoy Bhattacharya <tanmoy@qcd.lanl.gov>
Subject: Re: Ada to C/C++ translator needed
Date: 1996/10/07
Date: 1996-10-07T00:00:00+00:00	[thread overview]
Message-ID: <y8afty6cgh.fsf@qcd.lanl.gov> (raw)
In-Reply-To: 52feul$os2@goanna.cs.rmit.edu.au


fred@genesis.demon.co.uk (Lawrence Kirby) writes:

> 
> In article <y8rancyr0n.fsf@qcd.lanl.gov>
>            tanmoy@qcd.lanl.gov "Tanmoy Bhattacharya" writes:
> 
> >Not quite. It is still not allowed to violate constraints (This came
> >up in the discussion about `char a[1?1:(0,0)]' or some such
> >meaningless example in comp.std.c). j++ in a constant expression is a
> >violation of a constraint and must be diagnosed. 
> 
> I'm sure you're right but which constraint does it violate?
> 

6.4 Constraint: 

"Constant expressions shall not contain assignment, increment,
 decrement, function-call, or comma operators, except when they are
 contained within the operand of a sizeof operator.

 Each constant expression shall evaluate to a constant that is in the
 range of representable values of its type."

Note that it does not forbid use of contents of objects (that is in
the semantics section), but it does forbid operators that change the
values of objects, operators that invoke separate body of code, and
the comma operator. Incidentally, assignment operators include
(6.3.16) both the simple assignment operator =, and also the compound
forms like += etc.; and hence all of these are forbidden.

The semantics section forbids a lot more (e.g. using floating point
arithmetic if the final answer is integral, using pointers except
within sizeof if the final answer is arithmetic, accessing the value
of an object etc.)

Cheers
Tanmoy
-- 
tanmoy@qcd.lanl.gov(128.165.23.46) DECNET: BETA::"tanmoy@lanl.gov"(1.218=1242)
Tanmoy Bhattacharya O:T-8(MS B285)LANL,NM87545 H:#9,3000,Trinity Drive,NM87544
Others see <gopher://yaleinfo.yale.edu:7700/00/Internet-People/internet-mail>,
<http://alpha.acast.nova.edu/cgi-bin/inmgq.pl>or<ftp://csd4.csd.uwm.edu/pub/
internetwork-mail-guide>. -- <http://nqcd.lanl.gov/people/tanmoy/tanmoy.html>
fax: 1 (505) 665 3003   voice: 1 (505) 665 4733    [ Home: 1 (505) 662 5596 ]




  parent reply	other threads:[~1996-10-07  0:00 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-09-25  0:00 Ada to C/C++ translator needed Emmanuel Champommier
1996-09-25  0:00 ` David Weller
1996-10-02  0:00   ` B|rje Norden
1996-10-04  0:00     ` David Weller
1996-10-05  0:00     ` Robert Dewar
1996-10-05  0:00       ` Frank Manning
1996-10-06  0:00         ` Samuel Tardieu
1996-10-07  0:00           ` Richard Kenner
1996-10-07  0:00             ` Robert Dewar
1996-10-08  0:00             ` Stephen Leake
1996-10-07  0:00         ` Robert Dewar
1996-10-08  0:00           ` Frank Manning
1996-10-07  0:00   ` Erik Magnuson
1996-09-26  0:00 ` Ian Ward
     [not found]   ` <52feul$os2@goanna.cs.rmit.edu.au>
1996-09-28  0:00     ` Tim Behrendsen
1996-09-29  0:00       ` Ken Pizzini
1996-09-29  0:00         ` Tim Behrendsen
1996-09-29  0:00           ` Robert Dewar
1996-09-30  0:00             ` Tim Behrendsen
1996-09-30  0:00               ` Matthew Heaney
1996-09-30  0:00                 ` Tim Behrendsen
1996-09-30  0:00               ` William Clodius
1996-10-01  0:00               ` Richard A. O'Keefe
1996-09-30  0:00           ` Richard A. O'Keefe
1996-09-30  0:00             ` Tim Behrendsen
1996-09-30  0:00       ` Richard A. O'Keefe
1996-09-30  0:00         ` Peter Seebach
1996-10-02  0:00           ` Richard A. O'Keefe
1996-10-05  0:00             ` Lawrence Kirby
1996-09-30  0:00         ` Tim Behrendsen
1996-09-30  0:00           ` Peter Seebach
1996-09-30  0:00             ` Tim Behrendsen
1996-10-01  0:00           ` Richard A. O'Keefe
1996-10-01  0:00             ` Tim Behrendsen
1996-10-02  0:00               ` Ian Ward
1996-10-02  0:00                 ` Tim Behrendsen
1996-10-06  0:00     ` Tanmoy Bhattacharya
1996-10-06  0:00       ` Lawrence Kirby
1996-10-08  0:00         ` Peter Seebach
1996-10-07  0:00     ` Tanmoy Bhattacharya [this message]
1996-10-02  0:00   ` Jon S Anthony
1996-10-02  0:00   ` Jon S Anthony
  -- strict thread matches above, loose matches on Subject: below --
1996-10-02  0:00 Simon Johnston
1996-10-07  0:00 ` Richard Riehle
1996-10-09  0:00   ` Richard A. O'Keefe
1996-10-15  0:00     ` Tucker Taft
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox