Using a regular string as a code for compiling -
i need make function receives string such as:
int *ptr[20], *p, p2, p3[3];
and function need print:
ptr requires 80 bytes. p requires 4 bytes. p2 requires 4 bytes. p3 requires 12 bytes.
to simplify task, use "fake" code in string "real" code, , print function sizeof(variable) answer question. think simple way. how it?
what describe ability "evaluate" dynamically generated code.
some languages -- evaluated (non-compiled) ones -- have such features, c++ not.
even if did, wouldn't solution here. need parser. formal approach, may research lexers , context-free parsers. ad hoc approach...well...do whatever string manipulation like.
Comments
Post a Comment