On Mon, Jun 16, 2008 at 3:49 PM, John Peterson <[EMAIL PROTECTED]> wrote:
> On Mon, Jun 16, 2008 at 3:35 PM, John Peterson <[EMAIL PROTECTED]> wrote:
>> On Mon, Jun 16, 2008 at 3:35 PM, John Peterson <[EMAIL PROTECTED]> wrote:
>>> On Mon, Jun 16, 2008 at 1:50 PM, Roy Stogner <[EMAIL PROTECTED]> wrote:
>>>>
>>>> Vikram just ran into this ugly problem while trying to get Ben's code
>>>> up to speed with SVN libMesh.  Here's a minimal test case:
>>>>
>>>>
>>>> test.C:
>>>>
>>>> extern "C" {
>>>> #include "petscoptions.h"
>>>> }
>>>> #include <tr1/unordered_map>
>>>>
>>>>
>>>>
>>>> That's it.  Trying to compile this breaks in the CFDLab in all sorts
>>>> of fun ways.  We can work around it for now by turning off
>>>> TR1_UNORDERED_MAP support (which IIRC was giving Andrea some problems
>>>> over in ICES too), but I'm curious if anyone else can replicate this.
>>>> Is it a quirk of our particular (somewhat out of date) PETSc and gcc
>>>> versions, or is there some conflict between the PETSc namespace and
>>>> the new C++ hash map standard?
>>>
>>> I think the problem is with Petsc.  If you include "petsc.h" before
>>> petscoptions.h I think it will go away?
>>
>> Crap, nevermind.  If you include tr1/unordered_map *before*
>> petscoptions.h it goes away.
>>
>
> OK, there's a line in
> /usr/local/petsc/petsc-2.3.1/include/petscerror.h, line 261 --
>
> extern  PetscErrorCode __gierr;
>
> the petsc folks define __gierr and then the gcc people are apparently
> trying to use this same __gierr variable somewhere (I can't see
> exactly where at the moment but the error message alludes to it).  I
> think this is petsc's fault because you are never supposed to use
> variables starting with double underscore .
>
> By adding this option  to the compile line
>
> -DPETSC_SKIP_UNDERSCORE_CHKERR
>
> the compiler error seems to have gone away.  I'm not sure what this
> does to the behavior of the library, though.

Oh wait....it's even weirder.

Check out

/usr/include/c++/4.1.2/tr1/functional_iterate.h, line 398:

_Placeholder<_GLIBCXX_NUM_ARGS> _GLIBCXX_JOIN(_,_GLIBCXX_NUM_ARGS);

They actually use a single underscore as an argument to _GLIBCXX_JOIN,
whatever that is.  Now look again at petscerror.h, line 262:

#define _   __gierr =

They are actually redefining "underscore."  I have no clue why but
that can't be good programming practice.

-- 
John

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Libmesh-devel mailing list
Libmesh-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libmesh-devel

Reply via email to