Re: [petsc-dev] Compiling C code with C compiler
struct _p_Mat { PETSCHEADER(struct _MatOps); PetscLayout rmap,cmap; ... } typedef struct _p_Mat *Mat; Mat A; Now ((PetscObject)A)->comm is kosher, because of the way C lays out the struct. I don't know whether C++ does the same (there is the issue of where it sticks the vtable, and I'm not sure what else). I imagine there will be no problem, since we've been compiling the PETSc C code with C++ compilers for a decade now, but I don't know whether the C++ standard guarantees that. Jed is the only person I know that actually reads the standard (or maybe it's part of the ABI). Dmitry. On Mon, Apr 4, 2011 at 9:18 PM, Sean Farley <[email protected]> wrote:
But why would I do that? The whole point of invoking 'clang++' is to to
compile the code as 'C++' - not as 'C'
Why not try to compile C code with a C compiler and C++ code with a C++ compiler? (Perhaps I missed a previous discussion?) Dmitry brought up an interesting question of which I don't know the answer off the top of my head.
Dmitry, is there a small code example that shows this?
Sean
participants (1)
-
Dmitry Karpeev