4 ms·
I do find that C is difficult use for large programs. It there any thoughts that introducing features like namespaces. Another thing very cumbersome is to do i
by billfruit 7y ago
I do find that C is difficult use for large programs. It there any thoughts that introducing features like namespaces.
Another thing very cumbersome is to do in C is object creation; creating instantiable objects is possible very cumbersome. Is there some feature in the thoughy process to deal with it. To make it clear, in C we can create a data structure like a Stack or a queue easily. But if the program needs 10 stacks then presently no simple way of achieving it.
- DougGwyn 7y agoIn BRL's MUVES project, we used a 2-character prefix indicating category. E.g., all the external identifiers for our fancy memory allocator began with "Mm", where Mm.h documented the interface for the Mm package only. To minimize the external identifiers, one could make just the name of a container structure the sole entry access handle, with structure members pointing to the functions. Then use it like: #include <Mm.h> if ((new = Mm.allo(size)) == NULL) Er.abort("out of memory");
- jfkebwjsbx 7y agoTip: you can use four leading spaces to write code. Like this
- deleted 7y ago[deleted]
- steveklabnik 7y agoYou only need two! like this
- DougGwyn 7y agoI tried, but two spaces yielded what you saw.
- dang 7y agoHuh, it also needed an extra line break before the first line of code. I didn't realize that! I've fixed it now.
- DougGwyn 7y agoYou should be commended for the fast customer service!
- steveklabnik 7y agoI didn't realize that either, but it's described in formatdoc as such. So if you changed that behavior, probably should change the docs too.
- dang 7y agoI didn't change the behavior - I just added a newline. Sorry that wasn't clear.
- sgt 7y agoI did not know that, after spending years on HN. while(1) fork();
- steveklabnik 7y agohttps://news.ycombinator.com/formatdoc https://news.ycombinator.com/formatdoc