This is the mail archive of the gcc-patches@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: [PATCH] PR libstdc++/13045 / C++ demangler, floating values and function pointer type return type postfix fix.


Gabriel Dos Reis <gdr@integrable-solutions.net> writes:

> | But you can type 1e1000
> | and -1e1000 to get +Inf and -Inf.
> 
> You get +Inf or -Inf only if you ascribe/assume a given data type
> (with a limited precision) of an object that will contain that value.
> I.e. You're getting the value that would be represented in an object,
> while the issue here is that of a *literal* value.  Not quite the same.

I don't know templates work in theory, but g++ in practice will in
fact put a floating point value into an object of a particular type,
and it will emit that type in the mangled name before the value of
that type.  The grammar for a floating point literal in a mangled name
is
    L <type> <(value) float> E
where <type> is a mangled string representing a type, and <float> is
the literal string which we are discussing.

> | > signed zeros are spelt +0 and -0.
> | 
> | Actually, I can't produce a -0 either as literal in
> | a symbol.
> 
> Huh???? 

g++ will pull the `-' off, and represent this as something like
    ngLfXXXXXXXXE
Here `ng' is the negation operator, `L' is the start of the literal,
`f' is the type of the literal (in this example, float), `XXXXXXXX' is
the mangled floating point literal string, and `E' marks the end of
the literal string.

Ian


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