[C] Following my issue report, I would like to suggest the following modification to the function signature:
voiddecrypt(charconst*msg, char*buf);
Here, the input parameter msg is labelled const preventing in-place modification. The second parameter buf is an output parameter which the callee can assume is large enough to fit the result. The caller then ignores the return value of decrypt() and checks buf for the computed result.
This setup has the following advantages:
The input is not modified (good programming practice)
The callee does not have to worry about memory allocation
The caller can allocate buf using any method (static, dynamic, etc.) deemed appropriate and pass that buf to the callee
Final note: do not worry about invalidating existing solutions, and apply this change to NASM (and C++, if you are using char *) as well if you decide to implement this suggestion.
How different is this kata from https://www.codewars.com/kata/559c7b6e3c38b1d1b900006f, except the line break requirement (which is sort of trivial) and wrapping the formatted text inside a meme?
[C] Following my issue report, I would like to suggest the following modification to the function signature:
Here, the input parameter
msg
is labelledconst
preventing in-place modification. The second parameterbuf
is an output parameter which the callee can assume is large enough to fit the result. The caller then ignores the return value ofdecrypt()
and checksbuf
for the computed result.This setup has the following advantages:
buf
using any method (static, dynamic, etc.) deemed appropriate and pass thatbuf
to the calleeFinal note: do not worry about invalidating existing solutions, and apply this change to NASM (and C++, if you are using
char *
) as well if you decide to implement this suggestion.String translation is a duplicate.