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.


Ian Lance Taylor <ian@wasabisystems.com> writes:

| 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.

But, the actual values cannot be +inf or -inf -- because the type
system does not allow for those values.  

| > | > 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.

But, here we're talking about an alternate representation of floating
values, i.e. C99 hex floating notation.  So that that thing g++ used
to do has to spelt with the proposed normal form.

-- Gaby


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