This is the mail archive of the gcc-bugs@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]

Re: G++ preprocessor problem with unary ##


At 07:43 20/03/01 +0000, Neil Booth wrote:
>This has come up before.

>Simply deleting the ## should work.  There is no such thing as unary ##;
>just like there is no such thing as unary division :-)  ## pastes two
>surrounding tokens to form a single token; if it doesn't form a single
>token it is an error in the source code.

Please read further down the message.  Yes, deleting most of the "unary ##"
operators doesn't cause the code to break under 2.95, and does get rid of
the warnings in 2.96.

But deleting *all* of the "unary ##" makes the code fail to compile, even
under 2.95.  The problem is that in one particular place, use of ## seems
to prevent a macro expansion from being rescanned, and allows a whole
comma-separated list generated by that macro expansion to be passed as a
*single* argument to another macro.  And the design of the code depends on
being able to pass a list as a single argument, so if you "fix" the
code by eliminating the ##, it no longer compiles at all - under either
version of gcc.

It seems that this particular header file is using ## in a distinctly
non-portable way, which is what I suspected.

>Also, I don't recommend you use 2.96 for preprocessing, if you're
>referring to early revisions of the RedHat release.

It's the latest version of 2.96 available from Red Hat's "bug fix" list,
not the original version that was on the CD.  However, this particular
problem doesn't seem to be different between the two versions of 2.96.

>Have none of the people who have fixed LEDA sent their fixes upstream?

Well, that's another awkward problem.  I have a LEDA source licence,
obtained free as an academic user.  A month ago, the people who created
LEDA decided not to support the academic version anymore, leaving only
the commercial supplier of the library.  There apparently were bug fixes
and diffs on the academic site at one time, but no longer.

Single-user academic licences from Algorithmic Solutions (commercial LEDA)
are cheap enough, but are binary-only, and when I tried before the
binary distribution did not work - that's why I have the source now.
The only source version now available costs something like $12000 USD,
which is entirely out of the question.  And the organization which provides
support does not seem to have any web pages with bug fixes available to
people who are not paying for support.  So I'm somewhat stranded.

Obviously, I don't like this situation, and if I had plenty of time
I'd rewrite my code to use a different library, or just implement what
I need from scratch.  But I don't have that time, so I need to make
what was once working continue to work.

	Dave


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