As long as you are handling good data, it's clearly more efficient.
not in x86
People who go ape-shit over 0-terminated strings would probably be even more upset if we still did that.
The PDP-11 features that make this possible are (1) post increment addressing and (2) MOVE instructions set the condition codes.
Pascal strings were significantly size-limited due to memory constraints (an implementation detail), so there was a reason to prefer null termination, but in essence we're still slaves to an obsolete instruction set.
For example, a string copy 'instruction' that copies a 0 terminated string from one location to another looks like this:
lea esi, source_string
lea edi, dest_string
repnz movsb ; copies esi -> edi until *esi = 0repnz movsb is undocumented and undefined, MOVS doesnt modify flags, not sure how would that work
While the rep/repe/repnz can be used in conjunction with movs(b/w) it will not terminate on the z flag in the eflags register (so it won't stop if *esi == 0) but rather when ecx = 0.
So ecx needs to contain the size of the string you want to move, and rep movsb does not use the zero flag.
All Pascal dialects like Apple Pascal and Turbo Pascal had pointer arithmetic.
Should I list all the compiler specific features that everyday C programmer uses but aren't defined in ANSI C, e.g. inline assembly?
No professional Pascal compiler was a pure ISO Pascal, that error was left for schools teaching bad Pascal.
Professional Pascal compilers were way more powerful than C, safer and in the days of K&R C chaos, just as portable.