3 ms·
This all comes down to design decisions on a higher level - why arent your elements fixed-size? Why are you using delimiters at all, instead of a [size|content]
by lionkor 4y ago
This all comes down to design decisions on a higher level - why arent your elements fixed-size? Why are you using delimiters at all, instead of a [size|content][size|content] kind of layout? You dont need the delimiter if you know, for each element, how big it is, which also tells you where the next one starts. No more magic delimiters, and no find, substring until, etc.
- Joker_vD 4y ago> You dont need the delimiter if you know, for each element, how big it is Do you seriously propose writing something like 2,7Sdata2,3Cfoo2,3Cbar2,4C12343,11Chello world2,7Cgoodbye2,7Chunter23,26Cswordfish is a red herring instead of data: string[7] = { "foo", "bar", "1234", "hello world", "goodbye", "hunter2", "swordfish is a red herring", } ? Thanks but no thanks, almost nobody likes to write Bencode by hand, just trust me.