[EMBOSS] incorporating old code in 2.9.0

Peter Rice pmr at ebi.ac.uk
Fri Jul 23 11:14:57 UTC 2004


Derek Gatherer wrote:

(see Derek's previous message to emboss at embnet.org for the problem - copied to 
emboss-dev because developers will need to know the answer).

Solution: All variable declarations of the type:

AjPStr astr, bstr;

must be split into single variables from EMBOSS 2.9.0:

AjPStr astr;
AjPStr bstr;

Explanation follows.

> Hi Peter
> 
> Here is the full error set for one of the apps:
> 
> compact.c: In function `main':
> compact.c:53: error: incompatible types in assignment
> 
> and the code is attached.
> 
> #include "emboss.h"
> int main (int argc, char **argv)
> {
>   AjPStr cseq, cseqo;
>   cseq = ajStrNew();
>   cseqo = ajStrNew();

Ah, all is now clear. I just kept the relevant lines included above.

Note that the cseq line is fine, the cseqo line is the one that gives the error.

The cause is the redefinition of AjPStr as a macro to make "const AjPStr" 
work. Sorry, I forgot to stress this one in the release notes.

The problem is the line:

AjPStr cseq, cseqo;

Because AjPStr is now a macro that is replaced by "const AjOStr*" the 
definition of cseqo becomes:

const AjOStr* cseq, cseqo;

This is a classic C problem - cseq is now an AjPStr, cseqo is only an AjOStr 
(what an AjPStr points to).

The solution ...

AjPStr cseq;
AjPStr cseqo;

All AjP definitions have to now be one per line.

Sorry - we worked very hard to avouid this, but the compilers simply fail to 
put the const in the right place otherwise so we have to live with the macro 
and this side effect.

This should solve your problems.

regards,

Peter Rice




More information about the emboss-dev mailing list