<div><br></div><div>struct _p_Mat {</div><div> PETSCHEADER(struct _MatOps);</div><div> PetscLayout rmap,cmap;</div><div> ...</div><div>}</div><div><meta http-equiv="content-type" content="text/html; charset=utf-8">typedef struct _p_Mat *Mat;</div>
<div>Mat A;</div><div>Now ((PetscObject)A)->comm is kosher, because of the way C lays out the struct.</div><div>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).</div>
<div>I imagine there will be no problem, since we've been compiling the PETSc C code with C++ compilers for a decade now,</div><div>but I don't know whether the C++ standard guarantees that. Jed is the only person I know that actually reads the standard</div>
<div>(or maybe it's part of the ABI).</div><div><br></div><div>Dmitry.</div><br><div class="gmail_quote">On Mon, Apr 4, 2011 at 9:18 PM, Sean Farley <span dir="ltr"><<a href="mailto:sean@mcs.anl.gov">sean@mcs.anl.gov</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div class="gmail_quote"><div class="im"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><div>But why would I do that? The whole point of invoking 'clang++' is to to compile the</div>
</div>
code as 'C++' - not as 'C'</blockquote><div><br></div></div><div>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.</div>
<div><br></div><div>Dmitry, is there a small code example that shows this?</div><div><br></div><font color="#888888"><div>Sean</div></font></div>
</blockquote></div><br>