ciao a tutti, vi faccio una domanda che per molti di voi probabilmente risulterà essere una cavolata:
nel file pippo.h ho:
codice:
#ifndef SC_DEFINE_MESSAGE
#define SC_DEFINE_MESSAGE(id,unused1,unused2) \
namespace sc_core { extern const char id[]; }
}
#endif
SC_DEFINE_MESSAGE(SC_ID_STRING_TOO_LONG_,
801, "string is too long")
SC_DEFINE_MESSAGE(SC_ID_FRONT_ON_EMPTY_LIST_,
802, "attempt to take front() on an empty list")
mentre in pippo.cpp ho:
codice:
namespace sc_core {
#define SC_DEFINE_MESSAGE(id,unused,text) extern const char id[] = text;
#include "sysc/utils/pippo.h"
#undef SC_DEFINE_MESSAGE
mi chiedo:
1) nel cpp trovo
codice:
extern const char id[] = text;
, che senso ha scrivere extern sia nell'h che nel cpp dopo aver definito la variabile nel cpp?
2) i due SC_DEFINE_MESSAGE vanno in conflitto? non riesco a capire come agisce in questo caso il precompilatore!!!!
grazie mille!!
Marco