🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: constant-expression extension

#3588
From: Igor Boukanov
Date: Tue, 05 Mar 1996 17:44
32 lines
2151 bytes
J. Kanze (kanze@gabi-soft.fr) wrote:
> That it would be nice, but that there are two very big problems:

> 1. It would basically require a complete C++ interpreter in the
> compiler, and

But in almost all cases such interpreter is already present in C++ 
compilers! Because of cause all such const look expressions are correct 
C++ expressions so every C++ compiler has to generate a code that will 
evaluate them at run time and if forget about the crosscompilation case 
I think instead of putting the code to object file compiler can just execute 
it...

> 2. It would make the notion of constant expression somewhat
> implementation dependant.  Suppose my compiler implements the function
> sin as an inline invocation of a compiler built-in.  Can I then use sin
> in a constant expression?

Consider, for example, next:
const double x = 1.0 / (very small number); 
And of cause, the result will depend on exact representation of double... 

--
Regards, Igor Boukanov 
// igor.boukanov@fi.uib.no  http://www.fi.uib.no/~boukanov/
---
[ comp.std.c++ is moderated.  To submit articles: Try just posting with your 
                newsreader.  If that fails, use mailto:std-c++@ncar.ucar.edu
  comp.std.c++ FAQ: http://reality.sgi.com/austern/std-c++/faq.html
  Moderation policy: http://reality.sgi.com/austern/std-c++/policy.html
  Comments? mailto:std-c++-request@ncar.ucar.edu 
]
Technical Details
Message-ID: <4hh34b$21r@ugress.uib.no>
Path: arc1-ca.pugleaf.net!chronicle.mti.sgi.com!austern
References: <4h775a$m4s@ugress.uib.no> <KANZE.96Mar4120725@gabi.gabi-soft.fr>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!chronicle.mti.sgi.com!austern
From: boukanov@kvark.fi.uib.no (Igor Boukanov)
Newsgroups: comp.std.c++
Subject: Re: constant-expression extension
Date: 05 Mar 1996 09:44:14 PST
Organization: Fysisk institutt, Universitetet i Bergen
Approved: austern@isolde.mti.sgi.com
Message-ID: <4hh34b$21r@ugress.uib.no>
References: <4h775a$m4s@ugress.uib.no> <KANZE.96Mar4120725@gabi.gabi-soft.fr>
NNTP-Posting-Host: isolde.mti.sgi.com
X-Original-Date: 5 Mar 1996 09:56:27 GMT
X-Newsreader: TIN [version 1.2 PL2]
X-Auth: PGPMoose V1.1 PGP comp.std.c++
 iQBVAwUBMTx9g0y4NqrwXLNJAQE3SQH+I4jWGL7LvAWWkiibThLzNqajQvTrGTNH
 LxFJ3+vZFGg28zanKKbq45Z3AhVldJXhtgmRBMeCmQPv9aJmUtYMHA==
 =14+b
Originator: austern@isolde.mti.sgi.com