#define XXXType const char* ----> #define XXXType char* ?

Lisandro Dalcin dalcinl at gmail.com
Mon Jun 23 14:38:59 CDT 2008


On 6/23/08, Barry Smith <bsmith at mcs.anl.gov> 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;
>

Mmm, just a bit ugly you have to add the 'const' keyword. I insist:
What would be the problem with ... ??

typedef const char* VecType;


-- 
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




More information about the petsc-dev mailing list