2 ms·
The problem is that it's just too tempting to write something like my_function(my_var, 3.6, "bzarflo", my_other_var, false); The string handling functions
by scythe 4y ago
The problem is that it's just too tempting to write something like
my_function(my_var, 3.6, "bzarflo", my_other_var, false);
The string handling functions are part of the story, but the null-terminated char * is produced when the compiler reaches a string literal, and writing code without being allowed to just use string literals when it's convenient tends to feel like coding with oven mitts on.
- lolcatuser 4y agoIt's entirely possible to write a wrapper function with a short name to convert string literals to actual string objects. my_function(my_var, 3.6, $("bzarflo"), my_other_var, false); Isn't that much more of a mouthful, and as long as 'my_function' knows to free it, then you're A-OK! The only trouble is '$()' isn't legal in standard C, so a real solution would have to be something like 'str()'.