Mmm, just a bit ugly you have to add the 'const' keyword. I insist: What would be the problem with ... ??
typedef const char* VecType;
Two problems. The VecType is a const which means one cannot build them on the fly and copy into them etc Second with the typedef one cannot do all the string manipulation on them. For example even the PetscStrcpy() in PetscHeaderCreate_Private() of type_name does not work. It would be nice to use a typedef instead of a define to build it but it looks impossible. (Try it, just change one of them and try to compile PETSc, the screaming is relentless.) Barry On Jun 23, 2008, at 2:38 PM, Lisandro Dalcin wrote:
On 6/23/08, Barry Smith <[email protected]> wrote:
A while ago I made XXType (MatType, VecType etc) const char*
Well, you actually did
#define VecType const char*
instead of
typedef const char* VecType;
which IMHO is the right way.
I now think that was a mistake.
Yep, the '#define' way can cause problems ;-)
I'd like to change them to just char*
But why not the 'typedef' way ??
Can anyone suggest a technical reason why this is a bad idea before I push the code?
Note this means if you have code like
VecType t = VECMPI;
you would need to change it to
const VecType t = VECMPI;
-- Lisandro Dalc�n --------------- Centro Internacional de M�todos Computacionales en Ingenier�a (CIMEC) Instituto de Desarrollo Tecnol�gico para la Industria Qu�mica (INTEC) Consejo Nacional de Investigaciones Cient�ficas y T�cnicas (CONICET) PTLC - G�emes 3450, (3000) Santa Fe, Argentina Tel/Fax: +54-(0)342-451.1594