diff --git a/maca_graph_parser/CMakeLists.txt b/maca_graph_parser/CMakeLists.txt
index 3d1ab1fe5709b1400a71bb761b3902626de7cdc1..a134acc344d745c561a18d1cf05c221993e316c3 100644
--- a/maca_graph_parser/CMakeLists.txt
+++ b/maca_graph_parser/CMakeLists.txt
@@ -36,6 +36,7 @@ set(SOURCES
 #compiling library
 include_directories(.)
 add_library(graph_parser STATIC ${SOURCES})
+add_library(graph_parser_obj OBJECT ${SOURCES})
 #target_link_libraries(graph_parser perceptron)
 
 #compiling, linking and installing executables
diff --git a/maca_graph_parser/hash.c b/maca_graph_parser/hash.c
index d4a821768b6537afa464ba1a5b8d36ab26f6b050..60774954627abcf9aa290bbd77f525c1dacc069c 100644
--- a/maca_graph_parser/hash.c
+++ b/maca_graph_parser/hash.c
@@ -4,7 +4,7 @@
 
 #include"hash.h"
 
-cell *cell_new(char *key, int val, cell *next)
+cell *graph_parser_cell_new(char *key, int val, cell *next)
 {
   cell *c = (cell *)malloc(sizeof(cell));
   c->val = val;
@@ -13,16 +13,16 @@ cell *cell_new(char *key, int val, cell *next)
   return c;
 }
 
-void cell_free(cell *c)
+void graph_parser_cell_free(cell *c)
 {
   if(c == NULL) return;
-  cell_free(c->next);
+  graph_parser_cell_free(c->next);
   free(c->key);
   free(c);
 }
 
 
-hash_t *hash_new(int size)
+hash_t *graph_parser_hash_new(int size)
 {
   int i;
   hash_t *h = (hash_t *)malloc(sizeof(hash_t));
@@ -34,15 +34,15 @@ hash_t *hash_new(int size)
   return h;
 }
 
-void hash_free(hash_t *h)
+void graph_parser_hash_free(hash_t *h)
 {
   int i;
   for(i=0; i < h->size; i++)
-    cell_free(h->array[i]);
+    graph_parser_cell_free(h->array[i]);
   free(h);
 }
 
-int hash_func(char *key, int size)
+int graph_parser_hash_func(char *key, int size)
 {
   int i;
   int l = strlen(key);
@@ -52,9 +52,9 @@ int hash_func(char *key, int size)
   return val % size;
 }
 
-cell *hash_lookup(hash_t *h, char *key)
+cell *graph_parser_hash_lookup(hash_t *h, char *key)
 {
-  int index = hash_func(key, h->size);
+  int index = graph_parser_hash_func(key, h->size);
   cell *c;
   for(c=h->array[index]; c; c = c->next)
     if(!strcmp(key, c->key))
@@ -62,9 +62,9 @@ cell *hash_lookup(hash_t *h, char *key)
   return NULL;
 }
 
-int hash_get_val(hash_t *h, char *key)
+int graph_parser_hash_get_val(hash_t *h, char *key)
 {
-  int index = hash_func(key, h->size);
+  int index = graph_parser_hash_func(key, h->size);
   cell *c;
   for(c=h->array[index]; c; c = c->next)
     if(!strcmp(key, c->key))
@@ -72,22 +72,22 @@ int hash_get_val(hash_t *h, char *key)
   return HASH_INVALID_VAL;
 }
 
-void hash_add(hash_t *h, char *key, int val)
+void graph_parser_hash_add(hash_t *h, char *key, int val)
 {
   int index;
-  if(hash_lookup(h, key)) return;
-  index = hash_func(key, h->size);
-  h->array[index] = cell_new(key, val, h->array[index]);
+  if(graph_parser_hash_lookup(h, key)) return;
+  index = graph_parser_hash_func(key, h->size);
+  h->array[index] = graph_parser_cell_new(key, val, h->array[index]);
   h->nbelem++;
 }
 
-int cell_nb(cell *c)
+int graph_parser_cell_nb(cell *c)
 {
   if(c == NULL) return 0;
-  return 1 + cell_nb(c->next);
+  return 1 + graph_parser_cell_nb(c->next);
 }
 
-void hash_stats(hash_t *h)
+void graph_parser_hash_stats(hash_t *h)
 {
   int max = 0;
   int i,l;
@@ -95,14 +95,14 @@ void hash_stats(hash_t *h)
   int nb;
 
   for(i=0; i < h->size; i++)
-    if((l = cell_nb(h->array[i])) > max)
+    if((l = graph_parser_cell_nb(h->array[i])) > max)
     max = l;
   nb = max + 1;
   table = (int *)malloc(nb * sizeof(int));
   for(i=0; i < nb; i++)
     table[i] = 0;
   for(i=0; i < h->size; i++)
-    table[cell_nb(h->array[i])]++;
+    table[graph_parser_cell_nb(h->array[i])]++;
   
   for(i=0; i < nb; i++)
     printf("%d %d\n", i, table[i]);
diff --git a/maca_graph_parser/hash.h b/maca_graph_parser/hash.h
index 8f0bc0b435dd931e03feac2679f2977604fca69c..89e6f630e8a731583a0e8ec7cc2c3445d56a7a22 100644
--- a/maca_graph_parser/hash.h
+++ b/maca_graph_parser/hash.h
@@ -18,15 +18,15 @@ typedef struct
 } hash_t;
 
 
-cell *cell_new(char *key, int val, cell *next);
-void cell_free(cell *c);
-
-hash_t *hash_new(int size);
-void hash_free(hash_t *h);
-cell *hash_lookup(hash_t *h, char *key);
-int hash_get_val(hash_t *h, char *key);
-void hash_add(hash_t *h, char *key, int val);
-void hash_stats(hash_t *h);
+cell *graph_parser_cell_new(char *key, int val, cell *next);
+void graph_parser_cell_free(cell *c);
+
+hash_t *graph_parser_hash_new(int size);
+void graph_parser_hash_free(hash_t *h);
+cell *graph_parser_hash_lookup(hash_t *h, char *key);
+int graph_parser_hash_get_val(hash_t *h, char *key);
+void graph_parser_hash_add(hash_t *h, char *key, int val);
+void graph_parser_hash_stats(hash_t *h);
 
 
 #endif
diff --git a/maca_graph_parser/maca_graph_parser.c b/maca_graph_parser/maca_graph_parser.c
index 2b0d888900b94e7f7f1a0e44462f9a40715c2871..189c426064516bb73a4adcb01dea893dd31161a9 100644
--- a/maca_graph_parser/maca_graph_parser.c
+++ b/maca_graph_parser/maca_graph_parser.c
@@ -176,7 +176,7 @@ maca_graph_parser_ctx * maca_graph_parser_LoadCTX(int argc, char ** argv) {
     switch (c)
       {
       case 'h':
-	maca_graph_parser_PrintHelpMessage(argv[0]);
+	maca_graph_parser_PrintHelpMessage();
 	exit(0);
       case 'V':
 	fprintf(stderr, "%s version : %s\n", argv[0], MACA_GRAPH_PARSER_VERSION);
@@ -452,7 +452,7 @@ char * maca_graph_parser_GetVersion()
 char * maca_graph_parser_get_model_filename(char * cfg, int order)
 {
     char * filename;
-    char * path = maca_common_get_macaon_path(cfg);
+    char * path = maca_common_get_macaon_path();
     if(order == 2){
       filename = (char*)malloc(sizeof(char)*(strlen(path)+1+strlen(cfg)*2+5+strlen(MACA_GRAPH_PARSER_SECOND_MODEL_FILE_NAME)+1+4+1+1));
       /* sprintf(filename,"%s/%s/bin/%s_%s.bin",path,cfg,MACA_GRAPH_PARSER_SECOND_MODEL_FILE_NAME,cfg); */
@@ -469,7 +469,7 @@ char * maca_graph_parser_get_model_filename(char * cfg, int order)
 char * maca_graph_parser_get_alphabet_filename(char * cfg, int order)
 {
     char * filename;
-    char * path = maca_common_get_macaon_path(cfg);
+    char * path = maca_common_get_macaon_path();
     if(order == 2){
       filename = (char*)malloc(sizeof(char)*(strlen(path)+1+strlen(cfg)*2+5+strlen(MACA_GRAPH_PARSER_SECOND_ALPHA_FILE_NAME)+1+5+1+1));
       /* sprintf(filename,"%s/%s/bin/%s_%s.alpha",path,cfg,MACA_GRAPH_PARSER_SECOND_ALPHA_FILE_NAME,cfg); */
@@ -485,7 +485,7 @@ char * maca_graph_parser_get_alphabet_filename(char * cfg, int order)
 char * maca_graph_parser_get_dep_count_filename(char * cfg, int order)
 {
     char * filename;
-    char * path = maca_common_get_macaon_path(cfg);
+    char * path = maca_common_get_macaon_path();
     if(order == 2){
       filename = (char*)malloc(sizeof(char)*(strlen(path)+1+strlen(cfg)*2+5+strlen(MACA_GRAPH_PARSER_SECOND_DEP_COUNT_FILE_NAME)+1+10+1));
       /* sprintf(filename,"%s/%s/bin/%s_%s.dep_count",path,cfg,MACA_GRAPH_PARSER_SECOND_ALPHA_FILE_NAME,cfg); */
diff --git a/maca_graph_parser/maca_graph_parser_alphabet.c b/maca_graph_parser/maca_graph_parser_alphabet.c
index 2f503486a1647a0e6b77dd290745b1e5cfd97f29..d381670dfbe4642b3503aaf0e72e05907b5eecd5 100644
--- a/maca_graph_parser/maca_graph_parser_alphabet.c
+++ b/maca_graph_parser/maca_graph_parser_alphabet.c
@@ -29,7 +29,7 @@
 void maca_graph_parser_alphabet_free(maca_graph_parser_alphabet *a)
 {
   array_free(a->array);
-  hash_free(a->htable);
+  graph_parser_hash_free(a->htable);
   free(a->name);
   free(a);
 }
@@ -45,7 +45,7 @@ maca_graph_parser_alphabet *maca_graph_parser_alphabet_new(char *name)
   a->name = strdup(name);
   
   a->nb = 0;
-  a->htable = hash_new(16);
+  a->htable = graph_parser_hash_new(16);
   a->array = array_new();
   return a;
 }
@@ -59,11 +59,11 @@ int maca_graph_parser_alphabet_add_symbol(maca_graph_parser_alphabet *a, char *s
 
   /* fprintf(stderr, " maca_graph_parser_alphabet_add_symbol(%s)\n", symbol); */
 
-  found = hash_lookup(a->htable, symbol);
+  found = graph_parser_hash_lookup(a->htable, symbol);
   if(found == NULL){
       code = a->nb;
       symbol_copy = strdup(symbol);
-      hash_add(a->htable, symbol_copy, a->nb);
+      graph_parser_hash_add(a->htable, symbol_copy, a->nb);
       array_push(a->array, symbol_copy);
       a->nb++;
   } else {
@@ -76,7 +76,7 @@ int maca_graph_parser_alphabet_get_code(maca_graph_parser_alphabet *a, char *sym
 {
   cell *code;
 
-  code = hash_lookup(a->htable, symbol);
+  code = graph_parser_hash_lookup(a->htable, symbol);
   if(code == NULL)
     return MACA_GRAPH_PARSER_ALPHABET_INVALID_CODE;
   return code->val;
diff --git a/maca_graph_parser/maca_graph_parser_conll2007_format.c b/maca_graph_parser/maca_graph_parser_conll2007_format.c
index 72395483bd91ac94dd789352a4eb3679a8302401..0d5733ced1f56d1e7fbc1f0cc5a033304dd161db 100644
--- a/maca_graph_parser/maca_graph_parser_conll2007_format.c
+++ b/maca_graph_parser/maca_graph_parser_conll2007_format.c
@@ -1,4 +1,5 @@
 #include "maca_graph_parser_conll2007_format.h"
+#include "maca_alphabet.hh"
 
 #include <errno.h>
 #include <string.h>
diff --git a/maca_graph_parser/maca_graph_parser_corpora.c b/maca_graph_parser/maca_graph_parser_corpora.c
index 03869a5ef1f814170027f17560bf437009aaf558..f993a1b56f363939104f84de80865135a37480d5 100644
--- a/maca_graph_parser/maca_graph_parser_corpora.c
+++ b/maca_graph_parser/maca_graph_parser_corpora.c
@@ -10,13 +10,13 @@ hyp_ref_vector *allocate_hyp_ref_vector(int capacity){
 
   int i;
 
-  hyp_ref_vector *v = malloc(sizeof(hyp_ref_vector));
+  hyp_ref_vector *v = (hyp_ref_vector*) malloc(sizeof(hyp_ref_vector));
   if(v == NULL){
     fprintf(stderr, "allocate_hyp_ref_vector: memory alloc problem\n");
     exit(1);
   }
 
-  v->ref = malloc(capacity * sizeof(maca_graph_parser_sentence *));
+  v->ref = (maca_graph_parser_sentence**) malloc(capacity * sizeof(maca_graph_parser_sentence *));
   if(v->ref == NULL){
     fprintf(stderr, "allocate_hyp_ref_vector: memory alloc problem for ref\n");
     exit(1);    
@@ -25,7 +25,7 @@ hyp_ref_vector *allocate_hyp_ref_vector(int capacity){
     v->ref[i] = NULL;
   }
 
-  v->hyp = malloc(capacity * sizeof(maca_graph_parser_sentence *));
+  v->hyp = (maca_graph_parser_sentence**) malloc(capacity * sizeof(maca_graph_parser_sentence *));
   if(v->hyp == NULL){
     fprintf(stderr, "allocate_hyp_ref_vector: memory alloc problem for hyp\n");
     exit(1);    
diff --git a/maca_graph_parser/maca_graph_parser_decoder.c b/maca_graph_parser/maca_graph_parser_decoder.c
index 3d76cb3a1c2e31092c88f0b55c4e00e420d299f0..98deeb34882489454a31a9360fc0999a972163d2 100644
--- a/maca_graph_parser/maca_graph_parser_decoder.c
+++ b/maca_graph_parser/maca_graph_parser_decoder.c
@@ -118,7 +118,7 @@ Open *alloc_open(float score,
 		 Closed *left,
 		 Closed *right)
 {
-  Open *o = malloc(sizeof(Open));
+  Open *o = (Open*) malloc(sizeof(Open));
   if(o == NULL){
     fprintf(stderr, "memory allocation problem\n");
     exit(1);
@@ -143,7 +143,7 @@ Closed *alloc_closed(  float score,
 		       Closed *d,
 		       Open *u)
 {
-  Closed *c = malloc(sizeof(Closed));
+  Closed *c = (Closed*) malloc(sizeof(Closed));
   if(c == NULL){
     fprintf(stderr, "memory allocation problem\n");
     exit(1);
diff --git a/maca_graph_parser/maca_graph_parser_decoder1.c b/maca_graph_parser/maca_graph_parser_decoder1.c
index e53505019b20640726ae4f815ef1d6c9f9e2d42a..053ed52bc2d8d33949a2527bd67bcd96fc169636 100644
--- a/maca_graph_parser/maca_graph_parser_decoder1.c
+++ b/maca_graph_parser/maca_graph_parser_decoder1.c
@@ -421,20 +421,20 @@ void maca_graph_parser_decoder1_init(maca_graph_parser_ctx *ctx, maca_graph_pars
   int label; /*label*/
 
   // faster implementation
-  ctx->CLOSED = malloc(sizeof(Closed***) * sentence_length);
-  ctx->OPEN = malloc(sizeof(Open****) * sentence_length);
+  ctx->CLOSED = (Closed****) malloc(sizeof(Closed***) * sentence_length);
+  ctx->OPEN = (Open*****) malloc(sizeof(Open****) * sentence_length);
   if(sentence_length > 0) {
-      ctx->CLOSED[0] = malloc(sizeof(Closed**) * sentence_length * sentence_length);
-      ctx->CLOSED[0][0] = malloc(sizeof(Closed*) * sentence_length * sentence_length * 2);
+      ctx->CLOSED[0] = (Closed***) malloc(sizeof(Closed**) * sentence_length * sentence_length);
+      ctx->CLOSED[0][0] = (Closed**) malloc(sizeof(Closed*) * sentence_length * sentence_length * 2);
       for(start = 0; start < sentence_length; start++) {
           ctx->CLOSED[start] = ctx->CLOSED[0] + start * sentence_length;
           for(end = 0; end < sentence_length; end++) {
               ctx->CLOSED[start][end] = ctx->CLOSED[0][0] + ((start * sentence_length) + end) * 2;
           }
       }
-      ctx->OPEN[0] = malloc(sizeof(Open***) * sentence_length * sentence_length);
-      ctx->OPEN[0][0] = malloc(sizeof(Open**) * sentence_length * sentence_length * 2);
-      ctx->OPEN[0][0][0] = malloc(sizeof(Open*) * sentence_length * sentence_length * 2 * ctx->labels_nb);
+      ctx->OPEN[0] = (Open****) malloc(sizeof(Open***) * sentence_length * sentence_length);
+      ctx->OPEN[0][0] = (Open***) malloc(sizeof(Open**) * sentence_length * sentence_length * 2);
+      ctx->OPEN[0][0][0] = (Open**) malloc(sizeof(Open*) * sentence_length * sentence_length * 2 * ctx->labels_nb);
       for(start = 0; start < sentence_length; start++) {
           ctx->OPEN[start] = ctx->OPEN[0] + start * sentence_length;
           for(end = 0; end < sentence_length; end++) {
diff --git a/maca_graph_parser/maca_graph_parser_decoder2.c b/maca_graph_parser/maca_graph_parser_decoder2.c
index 4494e68fb251f8dbca4484b2efb42814955dd5b0..f4d5660d86d3ff4ebd2c712966529569f763c845 100644
--- a/maca_graph_parser/maca_graph_parser_decoder2.c
+++ b/maca_graph_parser/maca_graph_parser_decoder2.c
@@ -120,12 +120,12 @@ void maca_graph_parser_decoder2_init(maca_graph_parser_ctx *ctx, maca_graph_pars
   int m; /* breakpoint */
 
   // faster implementation
-  ctx->CLOSED2 = malloc(sizeof(Closed****) * sentence_length);
-  ctx->OPEN2 = malloc(sizeof(Open****) * sentence_length);
+  ctx->CLOSED2 = (Closed*****) malloc(sizeof(Closed****) * sentence_length);
+  ctx->OPEN2 = (Open*****) malloc(sizeof(Open****) * sentence_length);
   if(sentence_length > 0) {
-      ctx->CLOSED2[0] = malloc(sizeof(Closed**) * sentence_length * sentence_length);
-      ctx->CLOSED2[0][0] = malloc(sizeof(Closed*) * sentence_length * sentence_length * 2);
-      ctx->CLOSED2[0][0][0] = malloc(sizeof(Closed*) * sentence_length * sentence_length * 2 * sentence_length);
+      ctx->CLOSED2[0] = (Closed****) malloc(sizeof(Closed***) * sentence_length * sentence_length);
+      ctx->CLOSED2[0][0] = (Closed***) malloc(sizeof(Closed**) * sentence_length * sentence_length * 2);
+      ctx->CLOSED2[0][0][0] = (Closed**) malloc(sizeof(Closed*) * sentence_length * sentence_length * 2 * sentence_length);
       for(start = 0; start < sentence_length; start++) {
           ctx->CLOSED2[start] = ctx->CLOSED2[0] + start * sentence_length;
           for(end = 0; end < sentence_length; end++) {
@@ -135,9 +135,9 @@ void maca_graph_parser_decoder2_init(maca_graph_parser_ctx *ctx, maca_graph_pars
               }
           }
       }
-      ctx->OPEN2[0] = malloc(sizeof(Open***) * sentence_length * sentence_length);
-      ctx->OPEN2[0][0] = malloc(sizeof(Open**) * sentence_length * sentence_length * 2);
-      ctx->OPEN2[0][0][0] = malloc(sizeof(Open*) * sentence_length * sentence_length * 2 * ctx->labels_nb);
+      ctx->OPEN2[0] = (Open****) malloc(sizeof(Open***) * sentence_length * sentence_length);
+      ctx->OPEN2[0][0] = (Open***) malloc(sizeof(Open**) * sentence_length * sentence_length * 2);
+      ctx->OPEN2[0][0][0] = (Open**) malloc(sizeof(Open*) * sentence_length * sentence_length * 2 * ctx->labels_nb);
       for(start = 0; start < sentence_length; start++) {
           ctx->OPEN2[start] = ctx->OPEN2[0] + start * sentence_length;
           for(end = 0; end < sentence_length; end++) {
diff --git a/maca_graph_parser/maca_graph_parser_dep_count_table.c b/maca_graph_parser/maca_graph_parser_dep_count_table.c
index 1acde6e880d9d104fe7c281ab13712e8bfb79f20..607e0df86aba9f660f57669cee2d0d8891ab7e05 100644
--- a/maca_graph_parser/maca_graph_parser_dep_count_table.c
+++ b/maca_graph_parser/maca_graph_parser_dep_count_table.c
@@ -43,15 +43,15 @@ maca_graph_parser_dep_count_table maca_graph_parser_dep_count_table_allocate(int
   maca_graph_parser_dep_count_table t;
   int gov, dep, label, length_class;
 
-  t = malloc((size_t)pos_nb * sizeof(int ****));
+  t = (int*****) malloc((size_t)pos_nb * sizeof(int ****));
   for(gov = 0; gov < pos_nb; gov++){
-    t[gov] = malloc((size_t)pos_nb * sizeof(int ***));
+    t[gov] = (int****) malloc((size_t)pos_nb * sizeof(int ***));
     for(dep = 0; dep < pos_nb; dep++){
-      t[gov][dep] = malloc((size_t)synt_labels_nb * sizeof(int **));
+      t[gov][dep] = (int***) malloc((size_t)synt_labels_nb * sizeof(int **));
       for(label = 0; label < synt_labels_nb; label++){
-	t[gov][dep][label] = malloc(MAX_LENGTH_CLASSES * sizeof (int *));
+	t[gov][dep][label] = (int**) malloc(MAX_LENGTH_CLASSES * sizeof (int *));
 	for(length_class=0; length_class < MAX_LENGTH_CLASSES; length_class++){
-	  t[gov][dep][label][length_class] = malloc(2 * sizeof(int));
+	  t[gov][dep][label][length_class] = (int*) malloc(2 * sizeof(int));
 	  t[gov][dep][label][length_class][0] = 0;
 	  t[gov][dep][label][length_class][1] = 0;
 	}      
diff --git a/maca_graph_parser/maca_graph_parser_feature_counter.c b/maca_graph_parser/maca_graph_parser_feature_counter.c
index f3ffd06b3d2a196abf8a3dceb763f4d500e7e699..7b71b964025ce9119c61de6564b5b129a33e8a49 100644
--- a/maca_graph_parser/maca_graph_parser_feature_counter.c
+++ b/maca_graph_parser/maca_graph_parser_feature_counter.c
@@ -8,12 +8,12 @@ feature_counter *feature_counter_new(int nb_elts, float coeff){
    * Create a feature counter of size (nb_elts / coeff).
    */
   
-  feature_counter *c = malloc(sizeof(feature_counter));
+  feature_counter *c = (feature_counter*) malloc(sizeof(feature_counter));
 
   c->size = (int)((double) nb_elts / coeff);
   c->nb_elts = 0;
-  c->keys = malloc(sizeof(feature_t) * (size_t) c->size);
-  c->values = malloc(sizeof(int) * (size_t) c->size);
+  c->keys = (feature_t*) malloc(sizeof(feature_t) * (size_t) c->size);
+  c->values = (int*) malloc(sizeof(int) * (size_t) c->size);
   
   if((c->keys == NULL) || (c->values == NULL)){
     fprintf(stderr, "feature_counter_new: mem alloc error\n");
@@ -213,10 +213,10 @@ feature_count_vector *feature_counter_items(feature_counter *c){
 
 /* feature count vector */
 feature_count_vector *feature_count_vector_allocate(int size){
-  feature_count_vector *v = malloc(sizeof(feature_count_vector));
+  feature_count_vector *v = (feature_count_vector*) malloc(sizeof(feature_count_vector));
   v->size = size;
   v->nb_elts = 0;
-  v->counts = malloc(size * sizeof(feature_count));
+  v->counts = (feature_count*) malloc(size * sizeof(feature_count));
   return v;
 }
 
diff --git a/maca_graph_parser/maca_graph_parser_feature_counter_array.c b/maca_graph_parser/maca_graph_parser_feature_counter_array.c
index 074cdc6d67d77daffabf51130d1859a21f9e7dba..af18a58d20a846a9e265bf5415b936ed5a425968 100644
--- a/maca_graph_parser/maca_graph_parser_feature_counter_array.c
+++ b/maca_graph_parser/maca_graph_parser_feature_counter_array.c
@@ -9,7 +9,7 @@ feature_counter_array *allocate_feature_counter_array(maca_graph_parser_ctx *ctx
    * Allocate an array of feature counters.
    */
   
-  feature_counter_array *a = malloc(sizeof(feature_counter_array));
+  feature_counter_array *a = (feature_counter_array*) malloc(sizeof(feature_counter_array));
   a->size = 4;
   int i;
   for(i=0; i < a->size; i++){
diff --git a/maca_graph_parser/maca_graph_parser_feature_table.c b/maca_graph_parser/maca_graph_parser_feature_table.c
index cf644822ad265edabdd7a0ae70c30ea7cab33ec6..e1f9471993ebacd9ca64e3ec145e3f96c5d37fa3 100644
--- a/maca_graph_parser/maca_graph_parser_feature_table.c
+++ b/maca_graph_parser/maca_graph_parser_feature_table.c
@@ -365,7 +365,7 @@ void maca_graph_parser_feature_table_free(maca_graph_parser_ctx *ctx)
 
 void maca_graph_parser_feature_table_allocator(maca_graph_parser_ctx *ctx)
 {
-  maca_graph_parser_feature_table *d = malloc(sizeof(maca_graph_parser_feature_table));
+  maca_graph_parser_feature_table *d = (maca_graph_parser_feature_table*) malloc(sizeof(maca_graph_parser_feature_table));
   if(d == NULL){
     fprintf(stderr, "memory allocation error\n");
     exit(1);
@@ -381,9 +381,9 @@ void maca_graph_parser_feature_table_allocator(maca_graph_parser_ctx *ctx)
   d->gra = NULL;
 
   if(ctx->basic_features){
-    d->pl = malloc((size_t) length * sizeof(float **));
-    d->pl[0] = malloc((size_t) (length * length) * sizeof(float *));
-    d->pl[0][0] = malloc((size_t) (length * length * 2) * sizeof(float));
+    d->pl = (float***) malloc((size_t) length * sizeof(float **));
+    d->pl[0] = (float**) malloc((size_t) (length * length) * sizeof(float *));
+    d->pl[0][0] = (float*) malloc((size_t) (length * length * 2) * sizeof(float));
     for(i=0; i<length; i++){
       d->pl[i] = d->pl[0] + (i * length);
       for(j=0; j<length; j++){
@@ -394,10 +394,10 @@ void maca_graph_parser_feature_table_allocator(maca_graph_parser_ctx *ctx)
 
   if(ctx->first_features){
     /* [start][end][label][dir] */
-    d->lab = malloc((size_t) length * sizeof(float ***));
-    d->lab[0] = malloc((size_t) (length * length) * sizeof(float **));
-    d->lab[0][0] = malloc((size_t) (length * length * types * sizeof(float *)));
-    d->lab[0][0][0] = malloc((size_t) (length * length * types * 2 * sizeof(float)));
+    d->lab = (float****) malloc((size_t) length * sizeof(float ***));
+    d->lab[0] = (float***) malloc((size_t) (length * length) * sizeof(float **));
+    d->lab[0][0] = (float**) malloc((size_t) (length * length * types * sizeof(float *)));
+    d->lab[0][0][0] = (float*) malloc((size_t) (length * length * types * 2 * sizeof(float)));
     for(i=0; i<length; i++){
       d->lab[i] = d->lab[0] + (i * length); 
       for(j=0; j<length; j++){
@@ -411,11 +411,11 @@ void maca_graph_parser_feature_table_allocator(maca_graph_parser_ctx *ctx)
 
   if(ctx->sibling_features){
     /* [gov][dep][sib][dir][label] */
-    d->sib = malloc((size_t) length * sizeof(float ****));
-    d->sib[0] = malloc((size_t) (length * length) * sizeof(float ***));
-    d->sib[0][0] = malloc((size_t) (length * length * length) * sizeof(float **));
-    d->sib[0][0][0] = malloc((size_t) (length * length * length * 2) * sizeof(float *));
-    d->sib[0][0][0][0] = malloc((size_t) (length * length * length * 2 * types) * sizeof(float));
+    d->sib = (float*****) malloc((size_t) length * sizeof(float ****));
+    d->sib[0] = (float****) malloc((size_t) (length * length) * sizeof(float ***));
+    d->sib[0][0] = (float***) malloc((size_t) (length * length * length) * sizeof(float **));
+    d->sib[0][0][0] = (float**) malloc((size_t) (length * length * length * 2) * sizeof(float *));
+    d->sib[0][0][0][0] = (float*) malloc((size_t) (length * length * length * 2 * types) * sizeof(float));
     for(i=0; i<length; i++){
       d->sib[i] = d->sib[0] + (i * length);
       for(j=0; j<length; j++){
@@ -434,11 +434,11 @@ void maca_graph_parser_feature_table_allocator(maca_graph_parser_ctx *ctx)
 
   if(ctx->grandchildren_features){
     /* [gov][dep][gra][dir][label] */
-    d->gra = malloc((size_t) length * sizeof(float ****));
-    d->gra[0] = malloc((size_t) (length * length) * sizeof(float ***));
-    d->gra[0][0] = malloc((size_t) (length * length * length) * sizeof(float **));
-    d->gra[0][0][0] = malloc((size_t) (length * length * length * 2) * sizeof(float *));
-    d->gra[0][0][0][0] = malloc((size_t) (length * length * length * 2 * types) * sizeof(float));
+    d->gra = (float*****) malloc((size_t) length * sizeof(float ****));
+    d->gra[0] = (float****) malloc((size_t) (length * length) * sizeof(float ***));
+    d->gra[0][0] = (float***) malloc((size_t) (length * length * length) * sizeof(float **));
+    d->gra[0][0][0] = (float**) malloc((size_t) (length * length * length * 2) * sizeof(float *));
+    d->gra[0][0][0][0] = (float*) malloc((size_t) (length * length * length * 2 * types) * sizeof(float));
     for(i=0; i<length; i++){
       d->gra[i] = d->gra[0] + (i * length);
       for(j=0; j<length; j++){
diff --git a/maca_graph_parser/maca_graph_parser_feature_vector.c b/maca_graph_parser/maca_graph_parser_feature_vector.c
index e3ebee40d052dbdcaa92dabfa0d8b802f44a8d46..5bc4215fcef8f378ec1d946be3fe80678903479d 100644
--- a/maca_graph_parser/maca_graph_parser_feature_vector.c
+++ b/maca_graph_parser/maca_graph_parser_feature_vector.c
@@ -24,8 +24,8 @@
 
 feat_vector *allocate_feat_vector(int size)
 {
-  feat_vector *v = malloc(sizeof(feat_vector));
-  v->array = malloc((size_t)size * sizeof(feature_t));
+  feat_vector *v = (feat_vector*) malloc(sizeof(feat_vector));
+  v->array = (feature_t*) malloc((size_t)size * sizeof(feature_t));
   v->size = size;
   v->elt_nb = 0;
   return v;
@@ -59,8 +59,8 @@ void print_feat_vector(maca_graph_parser_ctx *ctx, feat_vector *fv){
 feat_matrix *allocate_feat_matrix(int lines, int columns)
 {
   int i;
-  feat_matrix *m = malloc(sizeof(feat_matrix));
-  m->array = malloc((size_t)lines * sizeof(feat_vector*));
+  feat_matrix *m = (feat_matrix*) malloc(sizeof(feat_matrix));
+  m->array = (feat_vector**) malloc((size_t)lines * sizeof(feat_vector*));
   for(i=0; i < lines; i++)
     m->array[i] = allocate_feat_vector(columns);
   m->size = lines;
diff --git a/maca_graph_parser/maca_graph_parser_features.c b/maca_graph_parser/maca_graph_parser_features.c
index 1b07c621f883ee56b706d471598987772fc1fc0b..7c61d62e783e17143616c950a97059999eb57dbc 100644
--- a/maca_graph_parser/maca_graph_parser_features.c
+++ b/maca_graph_parser/maca_graph_parser_features.c
@@ -161,7 +161,7 @@ templ *maca_graph_parser_templ_allocator(int v0, int v1, int v2, int v3, int v4,
   int start = 0;
   int end;
   /* int l; */
-  templ *t = malloc(sizeof(templ));
+  templ *t = (templ*) malloc(sizeof(templ));
   if(t == NULL){
     fprintf(stderr, "memory allocation error\n");
     exit(1);
@@ -286,7 +286,7 @@ maca_graph_parser_templ_library *maca_graph_parser_templ_library_allocator(maca_
    * FIXME: write a proper maca_graph_parser_templ_library_free() and use it !
    */
 
-  maca_graph_parser_templ_library *e = malloc(sizeof(maca_graph_parser_templ_library));
+  maca_graph_parser_templ_library *e = (maca_graph_parser_templ_library*) malloc(sizeof(maca_graph_parser_templ_library));
   if(e == NULL){
     fprintf(stderr, "memory allocation error\n");
     exit(1);
diff --git a/maca_graph_parser/maca_graph_parser_hash.c b/maca_graph_parser/maca_graph_parser_hash.c
index 264f01ef131b5fa29d79d37f68fc1a2b2f4f197e..018cd7de305ef00bbcf7be6ddfa04fe661614d6e 100644
--- a/maca_graph_parser/maca_graph_parser_hash.c
+++ b/maca_graph_parser/maca_graph_parser_hash.c
@@ -208,12 +208,12 @@ int range_hash(maca_graph_parser_hash *t, feature_t clef, float valeur, float va
 /*----------------------------------------------------------------*/
 maca_graph_parser_hash *load_table(FILE *f)
 {
-  maca_graph_parser_hash *t = malloc(sizeof(maca_graph_parser_hash));
+  maca_graph_parser_hash *t = (maca_graph_parser_hash*) malloc(sizeof(maca_graph_parser_hash));
   fread(&(t->taille), sizeof(int), 1, f);
   fread(&(t->nbelem), sizeof(int), 1, f);
   
-  t->table_clef = malloc((size_t)t->taille * sizeof(feature_t));
-  t->params = malloc((size_t)t->taille * sizeof(float));
+  t->table_clef = (feature_t*) malloc((size_t)t->taille * sizeof(feature_t));
+  t->params = (float*) malloc((size_t)t->taille * sizeof(float));
   t->total = NULL;
   fread(t->table_clef, sizeof(feature_t), (size_t)t->taille, f);
   fread(t->params, sizeof(float), (size_t)t->taille, f);
@@ -236,15 +236,15 @@ void dump_table(maca_graph_parser_hash *t, FILE *f)
 maca_graph_parser_hash *creation_table(int nbelem, float coeff)
 {
   int i;
-  maca_graph_parser_hash *t = malloc(sizeof(maca_graph_parser_hash));
+  maca_graph_parser_hash *t = (maca_graph_parser_hash*) malloc(sizeof(maca_graph_parser_hash));
 
   t->nbelem = 0;
   /* t->taille = prem_premier((int)((float)nbelem/coeff)); */
   t->taille = (int)((double)nbelem/coeff); // cast to double: prevent non-portable "excess precision"
 
-  t->params = malloc(sizeof(float) * (size_t)t->taille);
-  t->total = malloc(sizeof(float) * (size_t)t->taille);
-  t->table_clef = malloc(sizeof(feature_t) * (size_t)t->taille);
+  t->params = (float*) malloc(sizeof(float) * (size_t)t->taille);
+  t->total = (float*) malloc(sizeof(float) * (size_t)t->taille);
+  t->table_clef = (feature_t*) malloc(sizeof(feature_t) * (size_t)t->taille);
 
   if((t->params == NULL) || (t->total == NULL) || (t->table_clef == NULL)){
     fprintf(stderr, "memory allocation error!\n");
@@ -275,15 +275,15 @@ maca_graph_parser_feature_weight_table *feat_hash2feat_array(maca_graph_parser_h
 {
   int i, j = 0;
 
-  maca_graph_parser_feature_weight_table *table = malloc(sizeof(maca_graph_parser_feature_weight_table));
+  maca_graph_parser_feature_weight_table *table = (maca_graph_parser_feature_weight_table*) malloc(sizeof(maca_graph_parser_feature_weight_table));
   table->size = 0;
 
   for(i = 0; i < t->taille; i++)
     if((t->table_clef[i] != VIDE) && (t->params[i] != 0))
       table->size++;
 
-  table->features = malloc(table->size * sizeof(feature_t));
-  table->weights = malloc(table->size * sizeof(float));
+  table->features = (feature_t*) malloc(table->size * sizeof(feature_t));
+  table->weights = (float*) malloc(table->size * sizeof(float));
   for(i = 0; i < t->taille; i++){
     if((t->table_clef[i] != VIDE)  && (t->params[i] != 0)){
       table->features[j] = t->table_clef[i];
@@ -299,14 +299,14 @@ maca_graph_parser_feature_weight_table *feat_hash2feat_array(maca_graph_parser_h
 /*----------------------------------------------------------------*/
 maca_graph_parser_feature_weight_table *load_feature_weight_table(FILE *f)
 {
-  maca_graph_parser_feature_weight_table *t = malloc(sizeof(maca_graph_parser_feature_weight_table));
+  maca_graph_parser_feature_weight_table *t = (maca_graph_parser_feature_weight_table*) malloc(sizeof(maca_graph_parser_feature_weight_table));
   /* size */
   fread(&(t->size), sizeof(uint32_t), 1, f);
   /* features */
-  t->features  = malloc(t->size * sizeof(feature_t));
+  t->features  = (feature_t*) malloc(t->size * sizeof(feature_t));
   fread(t->features, sizeof(feature_t), t->size, f);
   /* weights */
-  t->weights = malloc(t->size * sizeof(float));
+  t->weights = (float*) malloc(t->size * sizeof(float));
   fread(t->weights, sizeof(float), t->size, f);
 
   return t;
@@ -333,7 +333,7 @@ void dump_feature_weight_table(maca_graph_parser_feature_weight_table *t, FILE *
 
 float *recherche_dicho(void *table, feature_t f)
 {
-  maca_graph_parser_feature_weight_table *t = table;
+  maca_graph_parser_feature_weight_table *t = (maca_graph_parser_feature_weight_table*) table;
   int first = 0; /* Indice du premier élément du sous-tableau analysé */
   int last = (int)t->size - 1; /* Indice du dernier élément du sous-tableau analysé */
   int middle; /* Indice de l'élément du milieu du sous-tableau analysé */
diff --git a/maca_graph_parser/maca_graph_parser_heapq.c b/maca_graph_parser/maca_graph_parser_heapq.c
index e46435fa8b4dbeb9bac8b881473a297594b771a2..a89c7dbd633ea69811fddb122ba5c137fa8f5667 100644
--- a/maca_graph_parser/maca_graph_parser_heapq.c
+++ b/maca_graph_parser/maca_graph_parser_heapq.c
@@ -164,12 +164,12 @@ void heap_insert_nmin(heap *h, float value, void *object){
  */
 heap *heap_create(const int max_size, const float dft_value){
   int i;
-  heap *h = malloc(sizeof(heap));
+  heap *h = (heap*) malloc(sizeof(heap));
   h->num = 0;
   h->max_size = max_size;
   h->dft_value = dft_value;
-  h->values = malloc(max_size * sizeof(float));
-  h->objects = malloc(max_size * sizeof(void *));
+  h->values = (float*) malloc(max_size * sizeof(float));
+  h->objects = (void**) malloc(max_size * sizeof(void *));
   /* init */
   for (i=0; i<max_size; i++){
     h->values[i] = dft_value;
diff --git a/maca_graph_parser/maca_graph_parser_hyperdecoder.c b/maca_graph_parser/maca_graph_parser_hyperdecoder.c
index c8834756ac0ae744268b7401d84d9c8e42cf09ea..2c0796846c7cce910156797fa709597fc8f8a2ee 100644
--- a/maca_graph_parser/maca_graph_parser_hyperdecoder.c
+++ b/maca_graph_parser/maca_graph_parser_hyperdecoder.c
@@ -87,7 +87,7 @@ cand_id *alloc_cand_id(int bs_i, int j[2]){
   /**
    * Allocate a candidate identifier
    */
-  cand_id *res = malloc(sizeof(cand_id));
+  cand_id *res = (cand_id*) malloc(sizeof(cand_id));
   if(res == NULL){
     fprintf(stderr, "memory allocation problem\n");
     exit(1);
@@ -114,7 +114,7 @@ vec_Dbp *alloc_vec_Dbp(int capacity){
    * Allocate a vector of derivations with backpointers
    */
 
-  vec_Dbp *res = malloc(sizeof(vec_Dbp));
+  vec_Dbp *res = (vec_Dbp*) malloc(sizeof(vec_Dbp));
   if(res == NULL){
     fprintf(stderr, "Mem prob\n");
     exit(1);
@@ -122,7 +122,7 @@ vec_Dbp *alloc_vec_Dbp(int capacity){
 
   res->num = 0;
   res->capacity = capacity;
-  res->elts = malloc(capacity * sizeof(DerivBP *));
+  res->elts = (DerivBP**) malloc(capacity * sizeof(DerivBP *));
   if(res->elts == NULL){
     fprintf(stderr, "Mem prob\n");
     exit(1);
@@ -265,20 +265,20 @@ void maca_graph_parser_hyperdecoder_init(maca_graph_parser_ctx *ctx, maca_graph_
   int dft_label = maca_alphabet_get_code(ctx->labels_alphabet, "__JOKER__");
 
   /* allocation of CLOSEDK, OPENK */
-  ctx->CLOSEDK = malloc(sizeof(Vertex***) * sentence_length);
-  ctx->OPENK = malloc(sizeof(Vertex****) * sentence_length);
+  ctx->CLOSEDK = (Vertex****) malloc(sizeof(Vertex***) * sentence_length);
+  ctx->OPENK = (Vertex*****) malloc(sizeof(Vertex****) * sentence_length);
   if(sentence_length > 0) {
-      ctx->CLOSEDK[0] = malloc(sizeof(Vertex**) * sentence_length * sentence_length);
-      ctx->CLOSEDK[0][0] = malloc(sizeof(Vertex*) * sentence_length * sentence_length * 2);
+      ctx->CLOSEDK[0] = (Vertex***) malloc(sizeof(Vertex**) * sentence_length * sentence_length);
+      ctx->CLOSEDK[0][0] = (Vertex**) malloc(sizeof(Vertex*) * sentence_length * sentence_length * 2);
       for(start = 0; start < sentence_length; start++) {
           ctx->CLOSEDK[start] = ctx->CLOSEDK[0] + start * sentence_length;
           for(end = 0; end < sentence_length; end++) {
               ctx->CLOSEDK[start][end] = ctx->CLOSEDK[0][0] + ((start * sentence_length) + end) * 2;
           }
       }
-      ctx->OPENK[0] = malloc(sizeof(Vertex***) * sentence_length * sentence_length);
-      ctx->OPENK[0][0] = malloc(sizeof(Vertex**) * sentence_length * sentence_length * 2);
-      ctx->OPENK[0][0][0] = malloc(sizeof(Vertex*) * sentence_length * sentence_length * 2 * ctx->labels_nb);
+      ctx->OPENK[0] = (Vertex****) malloc(sizeof(Vertex***) * sentence_length * sentence_length);
+      ctx->OPENK[0][0] = (Vertex***) malloc(sizeof(Vertex**) * sentence_length * sentence_length * 2);
+      ctx->OPENK[0][0][0] = (Vertex**) malloc(sizeof(Vertex*) * sentence_length * sentence_length * 2 * ctx->labels_nb);
       for(start = 0; start < sentence_length; start++) {
           ctx->OPENK[start] = ctx->OPENK[0] + start * sentence_length;
           for(end = 0; end < sentence_length; end++) {
@@ -304,20 +304,20 @@ void maca_graph_parser_hyperdecoder_init(maca_graph_parser_ctx *ctx, maca_graph_
   }
 
   /* allocation of CDERIV, ODERIV */
-  ctx->CDERIV = malloc(sizeof(vec_Dbp***) * sentence_length);
-  ctx->ODERIV = malloc(sizeof(vec_Dbp****) * sentence_length);
+  ctx->CDERIV = (vec_Dbp****) malloc(sizeof(vec_Dbp***) * sentence_length);
+  ctx->ODERIV = (vec_Dbp*****) malloc(sizeof(vec_Dbp****) * sentence_length);
   if(sentence_length > 0) {
-      ctx->CDERIV[0] = malloc(sizeof(vec_Dbp**) * sentence_length * sentence_length);
-      ctx->CDERIV[0][0] = malloc(sizeof(vec_Dbp*) * sentence_length * sentence_length * 2);
+      ctx->CDERIV[0] = (vec_Dbp***) malloc(sizeof(vec_Dbp**) * sentence_length * sentence_length);
+      ctx->CDERIV[0][0] = (vec_Dbp**) malloc(sizeof(vec_Dbp*) * sentence_length * sentence_length * 2);
       for(start = 0; start < sentence_length; start++) {
           ctx->CDERIV[start] = ctx->CDERIV[0] + start * sentence_length;
           for(end = 0; end < sentence_length; end++) {
               ctx->CDERIV[start][end] = ctx->CDERIV[0][0] + ((start * sentence_length) + end) * 2;
           }
       }
-      ctx->ODERIV[0] = malloc(sizeof(vec_Dbp***) * sentence_length * sentence_length);
-      ctx->ODERIV[0][0] = malloc(sizeof(vec_Dbp**) * sentence_length * sentence_length * 2);
-      ctx->ODERIV[0][0][0] = malloc(sizeof(vec_Dbp*) * sentence_length * sentence_length * 2 * ctx->labels_nb);
+      ctx->ODERIV[0] = (vec_Dbp****) malloc(sizeof(vec_Dbp***) * sentence_length * sentence_length);
+      ctx->ODERIV[0][0] = (vec_Dbp***) malloc(sizeof(vec_Dbp**) * sentence_length * sentence_length * 2);
+      ctx->ODERIV[0][0][0] = (vec_Dbp**) malloc(sizeof(vec_Dbp*) * sentence_length * sentence_length * 2 * ctx->labels_nb);
       for(start = 0; start < sentence_length; start++) {
           ctx->ODERIV[start] = ctx->ODERIV[0] + start * sentence_length;
           for(end = 0; end < sentence_length; end++) {
@@ -666,7 +666,7 @@ void append_next(maca_graph_parser_ctx *ctx, heap *cand, DerivBP *p,
   
   /* 9: <e,j> <- extract_min(cand) */
   heap_sort_nmax(cand);
-  c = heap_get(cand, 0);
+  c = (cand_id*) heap_get(cand, 0);
   w = heap_get_value(cand, 0);
   heap_extract_min(cand);
   /* c: (bs_i, j0, j1) */
@@ -735,18 +735,18 @@ void find_kbest(maca_graph_parser_ctx *ctx, Vertex *v, int k, maca_graph_parser_
   
   vDbp_v = get_vec_Dbp(ctx, v);
   /* alloc and init the array of already seen cand_ids */
-  seen_cand_ids = malloc(sizeof(cand_id ***) * (v->bs_size));
+  seen_cand_ids = (cand_id****) malloc(sizeof(cand_id ***) * (v->bs_size));
   if(seen_cand_ids == NULL){
     fprintf(stderr, "Mem alloc error\n");
     exit(1);
   }
   if(v->bs_size > 0){
-    seen_cand_ids[0] = malloc(sizeof(cand_id **) * (v->bs_size) * k);
+    seen_cand_ids[0] = (cand_id***) malloc(sizeof(cand_id **) * (v->bs_size) * k);
     if(seen_cand_ids[0] == NULL){
       fprintf(stderr, "Mem alloc error\n");
       exit(1);
     }
-    seen_cand_ids[0][0] = malloc(sizeof(cand_id *) * (v->bs_size) * k * k);
+    seen_cand_ids[0][0] = (cand_id**) malloc(sizeof(cand_id *) * (v->bs_size) * k * k);
     if(seen_cand_ids[0][0] == NULL){
       fprintf(stderr, "Mem alloc error\n");
       exit(1);
diff --git a/maca_graph_parser/maca_graph_parser_hypergraph.c b/maca_graph_parser/maca_graph_parser_hypergraph.c
index a8694f9ecc76685adf8e515b73420f6a3fa0dc9c..66e2538e89ddc16f608c2cc2044766794691bb79 100644
--- a/maca_graph_parser/maca_graph_parser_hypergraph.c
+++ b/maca_graph_parser/maca_graph_parser_hypergraph.c
@@ -18,7 +18,7 @@ VertexSignature *alloc_vertexSignature(){
    * Allocate a vertex signature.
    */
 
-  VertexSignature *v = malloc(sizeof(VertexSignature));
+  VertexSignature *v = (VertexSignature*) malloc(sizeof(VertexSignature));
   if(v == NULL){
     fprintf(stderr, "memory allocation problem\n");
     exit(1);
@@ -113,7 +113,7 @@ Vertex *alloc_vertex(){
    * Allocate a vertex whose tail tails has size bs_size.
    */
 
-  Vertex *v = malloc(sizeof(Vertex));
+  Vertex *v = (Vertex*) malloc(sizeof(Vertex));
   if(v == NULL){
     fprintf(stderr, "memory allocation problem\n");
     exit(1);
@@ -137,7 +137,7 @@ void init_vertex(Vertex *v, vec_Vertex *tails, size_t bs_size, VertexSignature *
   /* vertex signature */
   v->vsign = vs;
   /* backstar */
-  v->bs = malloc(bs_size * sizeof(Hyperarc *));
+  v->bs = (Hyperarc**) malloc(bs_size * sizeof(Hyperarc *));
   Vertex *t[2];
   int i;
   for(i=0; i<bs_size; i++){
@@ -184,7 +184,7 @@ Hyperarc *alloc_hyperarc(Vertex *tail[2], Vertex *head){
    * ----------
    *
    */
-  Hyperarc *e = malloc(sizeof(Hyperarc));
+  Hyperarc *e = (Hyperarc*) malloc(sizeof(Hyperarc));
   if(e == NULL){
     fprintf(stderr, "memory allocation problem\n");
     exit(1);
@@ -217,7 +217,7 @@ Derivation *alloc_derivation(float weight, Hyperarc *e, Derivation *subd[2]){
   /**
    *
    */
-  Derivation *d = malloc(sizeof(Derivation));
+  Derivation *d = (Derivation*) malloc(sizeof(Derivation));
   if(d==NULL){
     fprintf(stderr, "memory allocation problem\n");
     exit(1);
@@ -248,7 +248,7 @@ DerivBP *alloc_derivBP(float weight, Hyperarc *e, int j[2]){
    * ----------
    *
    */
-  DerivBP *d = malloc(sizeof(DerivBP));
+  DerivBP *d = (DerivBP*) malloc(sizeof(DerivBP));
   if(d == NULL){
     fprintf(stderr, "memory allocation problem\n");
     exit(1);    
@@ -280,7 +280,7 @@ vec_Vertex *alloc_vec_Vertex(int capacity){
   /**
    * Allocate a vector of vertices.
    */
-  vec_Vertex *res = malloc(sizeof(vec_Vertex));
+  vec_Vertex *res = (vec_Vertex*) malloc(sizeof(vec_Vertex));
   if(res == NULL){
     fprintf(stderr, "Mem prob\n");
     exit(1);
@@ -288,7 +288,8 @@ vec_Vertex *alloc_vec_Vertex(int capacity){
 
   res->num = 0;
   res->capacity = capacity;
-  res->elts = malloc(capacity * sizeof(Vertex *));
+  res->elts = (Vertex**) malloc(capacity * sizeof(Vertex *));
+
   if(res->elts == NULL){
     fprintf(stderr, "Mem prob\n");
     exit(1);
diff --git a/maca_graph_parser/maca_graph_parser_model.c b/maca_graph_parser/maca_graph_parser_model.c
index b1e3bd6f1f5a66d27078ac2c426b28459cfacd42..785c046b0509b3a178d837ed01111a4ecc65c803 100644
--- a/maca_graph_parser/maca_graph_parser_model.c
+++ b/maca_graph_parser/maca_graph_parser_model.c
@@ -24,7 +24,7 @@ maca_graph_parser_model *maca_graph_parser_model_allocate(maca_graph_parser_ctx
    * Allocate a model.
    */
 
-  maca_graph_parser_model *m = malloc(sizeof(maca_graph_parser_model));
+  maca_graph_parser_model *m = (maca_graph_parser_model*) malloc(sizeof(maca_graph_parser_model));
   if(m == NULL){
     maca_msg(ctx->module, MACA_ERROR);
     fprintf(stderr,"maca_graph_parser_model_allocate: memory allocation problem\n");
@@ -200,7 +200,7 @@ maca_graph_parser_model *maca_graph_parser_model_mmap(maca_graph_parser_ctx *ctx
     if(model->is_hash_model) {
         //model->feat_ht = load_table(model_file);
         maca_graph_parser_hash *t = NULL;
-        t = malloc(sizeof(maca_graph_parser_hash));
+        t = (maca_graph_parser_hash*) malloc(sizeof(maca_graph_parser_hash));
         t->taille = ((int*)model->mmap_data)[field_id++];
         t->nbelem = ((int*)model->mmap_data)[field_id++];
         t->table_clef = (feature_t*) (model->mmap_data + field_id * sizeof(int));
diff --git a/maca_graph_parser/maca_graph_parser_resize_model_main.c b/maca_graph_parser/maca_graph_parser_resize_model_main.c
index f3eb3334a1c889307b4e793b4a362e81fd3c7041..6f0fd4309ddef6163751be55d6f619c143419726 100644
--- a/maca_graph_parser/maca_graph_parser_resize_model_main.c
+++ b/maca_graph_parser/maca_graph_parser_resize_model_main.c
@@ -21,17 +21,17 @@ int main(int argc, char** argv) {
     fread(&nb_elements, sizeof(int), 1, input);
     fprintf(stderr, "size = %d\n", size);
     fprintf(stderr, "elements = %d\n", nb_elements);
-    uint64_t* table = malloc(sizeof(uint64_t) * size);
+    uint64_t* table = (uint64_t*) malloc(sizeof(uint64_t) * size);
     fread(table, size, sizeof(uint64_t), input);
-    float* weights = malloc(sizeof(float) * size);
+    float* weights = (float*) malloc(sizeof(float) * size);
     fread(weights, size, sizeof(float), input); 
 
     int new_size = nb_elements * 3;
     fwrite(&new_size, sizeof(int), 1, output);
     fwrite(&nb_elements, sizeof(int), 1, output);
 
-    uint64_t* table2 = calloc(sizeof(uint64_t), new_size);
-    float* weights2 = calloc(sizeof(float), new_size);
+    uint64_t* table2 = (uint64_t*) calloc(sizeof(uint64_t), new_size);
+    float* weights2 = (float*) calloc(sizeof(float), new_size);
 
     int num_collisions = 0;
     int max_collisions = 0;
diff --git a/maca_graph_parser/maca_graph_parser_sentence.c b/maca_graph_parser/maca_graph_parser_sentence.c
index 269baaedf9209fad00ae090007a544a826b1a207..2755aee3f2b67aa88da5eec37f6f8c61058f9bea 100644
--- a/maca_graph_parser/maca_graph_parser_sentence.c
+++ b/maca_graph_parser/maca_graph_parser_sentence.c
@@ -28,7 +28,7 @@ maca_graph_parser_sentence *maca_graph_parser_allocate_sentence(maca_graph_parse
    * Allocate a maca_graph_parser_sentence.
    */
 
-  maca_graph_parser_sentence *s = malloc(sizeof(maca_graph_parser_sentence));
+  maca_graph_parser_sentence *s = (maca_graph_parser_sentence*) malloc(sizeof(maca_graph_parser_sentence));
   if(s == NULL){
     maca_msg(ctx->module, MACA_ERROR);
     fprintf(stderr,"maca_graph_parser_allocate_sentence: memory allocation problem\n");
@@ -37,7 +37,7 @@ maca_graph_parser_sentence *maca_graph_parser_allocate_sentence(maca_graph_parse
   s->l = 0;
 
   /* dynamic allocation of fields */
-  s->word_adr = malloc(MACA_MAX_LENGTH_SENTENCE * sizeof(void*));
+  s->word_adr = (void**) malloc(MACA_MAX_LENGTH_SENTENCE * sizeof(void*));
   if(s->word_adr == NULL){
     maca_msg(ctx->module, MACA_ERROR);
     fprintf(stderr,"maca_graph_parser_allocate_sentence: memory allocation problem (2)\n");
@@ -47,25 +47,25 @@ maca_graph_parser_sentence *maca_graph_parser_allocate_sentence(maca_graph_parse
   for(i=0; i<MACA_MAX_LENGTH_SENTENCE; i++){
     s->word_adr[i] = NULL;
   }
-  s->words = malloc(MACA_MAX_LENGTH_SENTENCE * sizeof(int));
-  s->lemmas = malloc(MACA_MAX_LENGTH_SENTENCE * sizeof(int));
-  s->pos = malloc(MACA_MAX_LENGTH_SENTENCE * sizeof(int));
+  s->words = (int*) malloc(MACA_MAX_LENGTH_SENTENCE * sizeof(int));
+  s->lemmas = (int*) malloc(MACA_MAX_LENGTH_SENTENCE * sizeof(int));
+  s->pos = (int*) malloc(MACA_MAX_LENGTH_SENTENCE * sizeof(int));
 
-  s->morpho = malloc(MACA_MAX_LENGTH_SENTENCE * sizeof(int *));
+  s->morpho = (int**) malloc(MACA_MAX_LENGTH_SENTENCE * sizeof(int *));
   for(i=0; i<MACA_MAX_LENGTH_SENTENCE; i++){
-    s->morpho[i] = malloc(1 * sizeof(int));
+    s->morpho[i] = (int*) malloc(1 * sizeof(int));
     if(s->morpho[i] == NULL){
       maca_msg(ctx->module, MACA_ERROR);
       fprintf(stderr,"maca_graph_parser_allocate_sentence: memory allocation problem (3)\n");
       exit(1);
     }
   }
-  s->gov = malloc(MACA_MAX_LENGTH_SENTENCE * sizeof(int));
-  s->label = malloc(MACA_MAX_LENGTH_SENTENCE * sizeof(int));
+  s->gov = (int*) malloc(MACA_MAX_LENGTH_SENTENCE * sizeof(int));
+  s->label = (int*) malloc(MACA_MAX_LENGTH_SENTENCE * sizeof(int));
 
-  s->synt_feats_nb = malloc(MACA_MAX_LENGTH_SENTENCE * sizeof(int));
+  s->synt_feats_nb = (int*) malloc(MACA_MAX_LENGTH_SENTENCE * sizeof(int));
 
-  s->synt_feats_array = malloc(MACA_MAX_LENGTH_SENTENCE * sizeof(int *));
+  s->synt_feats_array = (int**) malloc(MACA_MAX_LENGTH_SENTENCE * sizeof(int *));
   for(i=0; i<MACA_MAX_LENGTH_SENTENCE; i++){
     s->synt_feats_array[i] = NULL;
   }
@@ -194,7 +194,7 @@ void maca_graph_parser_sentence_add_word(maca_graph_parser_ctx *ctx, maca_graph_
   s->label[s->l] = label;
   s->synt_feats_nb[s->l] = synt_feats_nb;
   if(synt_feats_nb > 0){
-    s->synt_feats_array[s->l] = malloc(synt_feats_nb * sizeof(int));
+    s->synt_feats_array[s->l] = (int*) malloc(synt_feats_nb * sizeof(int));
     for(i=0; i<synt_feats_nb; i++){
       s->synt_feats_array[s->l][i] = synt_feats_array[i];
     }
@@ -305,7 +305,7 @@ maca_graph_parser_sentence *maca_graph_parser_duplicate_sentence(maca_graph_pars
     copy->label[i] = -1;
     copy->synt_feats_nb[i] = sent->synt_feats_nb[i];
     if(copy->synt_feats_nb[i] > 0){
-      copy->synt_feats_array[i] = malloc(copy->synt_feats_nb[i] * sizeof(int));
+      copy->synt_feats_array[i] = (int*) malloc(copy->synt_feats_nb[i] * sizeof(int));
       for(j=0; j<copy->synt_feats_nb[i]; j++){
 	copy->synt_feats_array[i][j] = sent->synt_feats_array[i][j];
       }
@@ -330,7 +330,7 @@ maca_graph_parser_sentence_kbest *maca_graph_parser_allocate_sentence_kbest(maca
    * Allocate a structure to store the k-best parses of a sentence.
    */
   
-  maca_graph_parser_sentence_kbest *kb = malloc(sizeof(maca_graph_parser_sentence_kbest));
+  maca_graph_parser_sentence_kbest *kb = (maca_graph_parser_sentence_kbest*) malloc(sizeof(maca_graph_parser_sentence_kbest));
   if(kb == NULL){
     maca_msg(ctx->module, MACA_ERROR);
     fprintf(stderr,"maca_graph_parser_allocate_sentence_kbest: memory allocation problem\n");
@@ -339,13 +339,13 @@ maca_graph_parser_sentence_kbest *maca_graph_parser_allocate_sentence_kbest(maca
 
   /* fields */
   kb->k = ctx->k;
-  kb->gov = malloc(MACA_MAX_LENGTH_SENTENCE * sizeof(int *));
+  kb->gov = (int**) malloc(MACA_MAX_LENGTH_SENTENCE * sizeof(int *));
   if(kb->gov == NULL){
     maca_msg(ctx->module, MACA_ERROR);
     fprintf(stderr,"maca_graph_parser_allocate_sentence_kbest: memory allocation problem (2)\n");
     exit(1);
   }
-  kb->label = malloc(MACA_MAX_LENGTH_SENTENCE * sizeof(int *));
+  kb->label = (int**) malloc(MACA_MAX_LENGTH_SENTENCE * sizeof(int *));
   if(kb->label == NULL){
     maca_msg(ctx->module, MACA_ERROR);
     fprintf(stderr,"maca_graph_parser_allocate_sentence_kbest: memory allocation problem (3)\n");
@@ -355,14 +355,14 @@ maca_graph_parser_sentence_kbest *maca_graph_parser_allocate_sentence_kbest(maca
   int ki;
   int i;
   for(i=0; i<MACA_MAX_LENGTH_SENTENCE; i++){
-    kb->gov[i] = malloc((kb->k) * sizeof(int));
-    kb->label[i] = malloc((kb->k) * sizeof(int));
+    kb->gov[i] = (int*) malloc((kb->k) * sizeof(int));
+    kb->label[i] = (int*) malloc((kb->k) * sizeof(int));
     for(ki=0; ki<kb->k; ki++){
       kb->gov[i][ki] = 0;
       kb->label[i][ki] = -1;
     }
   }
-  kb->score = malloc((kb->k) * sizeof(float));
+  kb->score = (float*) malloc((kb->k) * sizeof(float));
   for(ki=0; ki<kb->k; ki++){
     kb->score[ki] = MINF;
   }
@@ -519,7 +519,7 @@ maca_mcf_sentence *maca_graph_parser_read_mcf_sentence(maca_graph_parser_ctx *ct
       if(ctx->subcat_features){
 	nb_synt_feats = maca_mcf_word_get_nb_values(mcf_word, ctx->mcf_subcat_id);
 	if (nb_synt_feats) {
-	  synt_feats = malloc(nb_synt_feats * sizeof(int));
+	  synt_feats = (int*) malloc(nb_synt_feats * sizeof(int));
 	  for (k = 0; k < nb_synt_feats; k++) {
 	    synt_feats[k] = maca_mcf_word_get_value_int(mcf_word, ctx->mcf_subcat_id, k);
 	  }
diff --git a/maca_graph_parser/maca_mcf_wrapper.h b/maca_graph_parser/maca_mcf_wrapper.h
index 7437b48f37c94896aef4e9798d61d394f952e57d..18de9add0b4ec8e9da79dba4afe6098e06d6597a 100644
--- a/maca_graph_parser/maca_mcf_wrapper.h
+++ b/maca_graph_parser/maca_mcf_wrapper.h
@@ -28,8 +28,8 @@ extern "C" {
   namespace macaon {};
   using namespace macaon;
 #else
-#include <stdio.h>
 #endif
+#include <stdio.h>
 
   typedef struct McfWord maca_mcf_word;