On November 5, 2002 01:33 pm, Jaco Greeff wrote:
I know there has been answers, but here are my $0.02:
- Implement funcA, making funcW and exact copy with the relevant
parameters and local variables changed;
- Implement a generic solution as a macro and get both funcA and funcW to
call it will specific parameters;
- Do some preprosessor magic as implemented in dlls/msvcrt/scanf.[hc]
These should be avoided as much as possible IMO. For too many reasons to list here. Option 4: 4. Implement the meat in funcW, and make funcA a wrapper that just converts the arguments from A->W and back (if need be). Is the most general. Sometimes there is Option 5: 5. Implement the meat in a funcT that takes a boolean as an argument telling it if the input is A or W, and just have the func[AW] forward the call to funcT This works only within one module, and there are other problems. That is, if it does any non-trivial work with the string, that might require that be converted between A<->W, it's better to go for 4, to avoid multiple conversions (which are expensive).