I have functions which get file path as their input argument. This functions are cross platform. Functions support both unicode and regular file paths. What is the best interface for this functions, know I have 2 chooses:
- make two version of each function
FunctionWandFunctionAas inWinAPI. - make one version which will get
char *as input argument, but this string must be inUTF8format.
Which one is better?
Thanks in advance!
This really depends on the rest of your code and how you’re going to use them. There is no correct answer here – try to approximate the time it will take you to write, to use and to maintain each one of the options, and try to take the one where it’s easier.
You should also consider the difference between
FunctionAandFunctionW. If the difference isn’t big, then you can likely use a single inner helper function that both of them will call, and so the extra time for writing and maintaining a second function is minimal. If it is, consider how tough it would be (if at all) to convert strings toUTF8for the 2nd option you presented.