Article View: comp.std.c++
Article #3596Re: constant-expression extension
From: David Vandevoorde
Date: Sat, 02 Mar 1996 16:04
Date: Sat, 02 Mar 1996 16:04
38 lines
1978 bytes
1978 bytes
>>>>> "IB" == Igor Boukanov <boukanov@afrodite.fi.uib.no> writes:
IB> My proposal is to change definition of the "integral
IB> constant-expression"[5.19] to something like this:
IB> An integral constant-expression is an expression that can be
IB> calculated at the compilation phase.
IB> And according to this one would be able to use inline functions in
IB> constant-expressions and instead of writing:
[...]
This would imply that `inline' is no longer mere ``hint'', but in certain
cases a requirement. Note that your proposed definition may either be
hard to implement or imprecise.
E.g.,
inline int fac(int k) {
int r = 1;
while (k) r *= k--;
return r;
}
double d[fac(10)]; // ??
It's certainly feasible to compute this at compile-time... but this sort
of requirement would make a compiler much more complex. (And it is not
feasible, in general, to determine whether it is feasible :).
Daveed
[ 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:
<xsoviknr24p.fsf@pleiades.cs.rpi.edu>Path:
arc1-ca.pugleaf.net!engnews1.Eng.Sun.COM!taumet!clamageReferences:
<4h775a$m4s@ugress.uib.no>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!engnews1.Eng.Sun.COM!taumet!clamage From: vandevod@cs.rpi.edu (David Vandevoorde) Newsgroups: comp.std.c++ Subject: Re: constant-expression extension Date: 2 Mar 1996 16:04:34 GMT Organization: RPI Computer Science Sender: vandevod@pleiades.cs.rpi.edu Approved: clamage@eng.sun.com (comp.std.c++) Message-ID: <xsoviknr24p.fsf@pleiades.cs.rpi.edu> References: <4h775a$m4s@ugress.uib.no> NNTP-Posting-Host: taumet.eng.sun.com Content-Type: text X-Nntp-Posting-Host: pleiades.cs.rpi.edu In-Reply-To: boukanov@afrodite.fi.uib.no's message of 01 Mar 1996 09:03:14 PST X-Newsreader: Gnus v5.1 Content-Length: 934 Originator: clamage@taumet