Hacker News new | ask | show | jobs
by EvaPeron 5026 days ago
One could of course write a wrapper function to create strings, like char* someString = makeAString("A String"); where makeAString takes a char* as input, allocates the memory it needs via malloc (I prefer calloc though as it is safer by setting the allocated memory to a default value, IMO), and returns a char* as output, thus saving lines of code whenever one wants to make a string. Probably stating the obvious I guess, but if one takes a few days to make some wrappers like that one saves time down the road. Were it my boss, I would say, OK, we can do it in C, but you need to give me time to make some wrappers that I need in order to get this done efficiently. Just a thought. :-)