8 ms·
In case anyone doesn't know, this is actually what Pascal and other "Wirth languages" do. The underlying representation of a string in memory has the length sto
by ajxs 4y ago
In case anyone doesn't know, this is actually what Pascal and other "Wirth languages" do. The underlying representation of a string in memory has the length stored before the string data.
- jagrsw 4y agoI remember vaguely that AmigaOS kept some remnants of this convention. Not from Pascal but from sth called B/CPL. A few (small majority) of system functions took arguments in this peculiar [<len><string>] format. Afaik AmigaOS itself was based on some earlier OS written in B or BCPL language. PS: Here's some story behind this http://aminet.net/package/dev/misc/BCPL http://aminet.net/package/dev/misc/BCPL
- magicalhippo 4y agoAnd Delphi also adds the terminating null, so interacting with C-style APIs is quick, as there's no explicit conversion needing to happen before passing it as a "C string".