This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
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:
> Ian Lance Taylor <ian@wasabisystems.com> writes:
>
> | Or, if you are suggesting that the mangling ABI be changed to use C99
> | hexadecimal floating point constants, then that sounds like a good
> | idea to me, certainly better than the current situation.
>
> That is essentially what I'm suggesting, but wanted to know its
> drawbacks compared to current choice.
Drawbacks:
1) Obviously, it is an ABI change, which means that code compiled with
gcc 3.3.1 and 3.3.2 may not link with code compiled with gcc 3.4
and higher (versions of gcc before 3.3 are broken anyhow; support
for gcc 3.3 itself is available with -fabi-version=1).
2) The same floating point number has multiple representations as a
C99 hex floating point constant. The ABI would have to be written
to constrain this in some way, such as requiring that the exponent
be a multiple of 4 and the significand have no more than three
trailing zero bits (i.e., no trailing hex zero digit). It should
be possible to guarantee interoperability given a specific floating
point format. (Note that it would still not be possible to
guarantee the same name given different floating point formats, but
it's not clear why anybody would care, since the functions would
most likely not be call compatible anyhow.)
3) Given such a constraint, it would be slightly more difficult to
implement this specification in the compiler than it is to
implement the current specification.
Advantages:
1) It would be possible to write a target-independent demangler.
2) ???
Do the advantages outweigh the drawbacks? Actually, I think they do.
But it's not like there are a lot of advantages.
Ian