Hacker News new | past | comments | ask | show | jobs | submit login

Modules work if they can operate without allocating or are generic over allocators. I don't really get why people think it's normal for e.g. a websocket decoder to insist on calling read, write, epoll, and mmap, if the user just wants to encode and decode messages.



There is no maximum size for a websocket message, so unless you want to force a size ahead of time, you might need to allocate to resize your buffer.

Or you could give the message in fragments to the user, but that immediately becomes a very inconvenient API.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: