typedefstructprenom{char*s;}Prenom;typedefstructnom{char*s;}Nom;#define makemaker(type) type make##type(char * s){ \ type tmp = {s}; \ return tmp; \ }#define makeconcat(type) void concat##type(type a, type b, type res){ \ strcpy(res.s, a.s); \ strcat(res.s, b.s); \ }// il faut quand même faire les déclarationsmakemaker(Nom)makemaker(Prenom)makeconcat(Nom)makeconcat(Prenom)
[^] # Re: Un peu faible
Posté par Zylabon . En réponse au journal Les types fantômes. Évalué à 1.
On peut n'écrire qu'une seule fois les fonctions,
Please do not feed the trolls