This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Invalid code in <limits>




--On Wednesday, January 29, 2003 07:16:12 AM +0100 Gabriel Dos Reis <gdr@integrable-solutions.net> wrote:

I believe that a general framework for "__builtin_" names (designating
compiler generated entities) is more scalable than relying on CPP.

  1) Use general rules to decide whether it is dependent;
  2) else perform lookup at the point of use and fold.
This approach introduces a lot of complexity.

Now, we cannot just issue an error when it sees a function call. Instead,
it has to look at the function called, check that the arguments are valid,
and then fold it. It can't do this for all builtins (for example __builtin_setjmp can't appear here), so it has to know that some
builtins are really constants and some aren't.

Actually, it's worse than I thought. If you *did* evaluate the builtins,
you'd get floating-point values which also can't appear in constant
expressions, unless immediately case to an integral or enumeration type.

I think the thing to do is just to make magic keywords for these boolean
values so that we can do:

static const bool has_infinity = __magic_has_infinity;

I'll try that tomorrow...

--
Mark Mitchell mark@codesourcery.com
CodeSourcery, LLC http://www.codesourcery.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]