Why is `scope` planned for deprecation?

Walter Bright via Digitalmars-d digitalmars-d at puremagic.com
Tue Nov 18 13:06:44 PST 2014


On 11/18/2014 9:01 AM, "Ola Fosheim Grøstad" 
<ola.fosheim.grostad+dlang at gmail.com>" wrote:
> On Sunday, 16 November 2014 at 21:54:40 UTC, Walter Bright wrote:
>> Besides, C was designed for the PDP-11, which had no such instructions.
>
> BTW, this is not entirely correct. It had autoincrement on registers.

Those are not dedicated string instructions. Autoincrement was an addressing 
mode that could be used with any register and any instruction, including the 
stack and program counter (!).

Autoincrement/autodecrement gave rise to *p++ and *p-- in C.

> This is the example given on Wikipedia:
>
>   MOV #MSG,R1
> 1$: MOVB (R1)+,R0
>   BEQ DONE
>   .TTYOUT
>   BR 1$
>   .EXIT
>
> MSG: .ASCIZ /Hello, world!/
>
> The full example:
>
> http://en.wikipedia.org/wiki/MACRO-11

More than destroyed by every time you have to call strlen().


> So the print loop is 4 instructions (I assume .TTYOUT is a I/O instruction),
> with a length you would at least have 5 instructions and use an extra register,
> as you would have an additional compare.

.TTYOUT is a macro that expands to code that calls the operating system. The 11 
doesn't have I/O instructions.


> (As for concat, that I almost never use. In systems programming you mostly
> append to buffers and flush when the buffer is full. Don't need length for that.

Uh, you need the length to determine when "the buffer is full".


> Even in javascript and python  I avoid regular concat due to the inefficency of
> concat versus a buffered join.)

Just try to manipulate paths, filenames, and extensions without using strlen() 
and strcat(). Your claim that C string code doesn't use strlen() is patently absurd.

Besides, you wouldn't be using javascript or python if efficiency mattered.


More information about the Digitalmars-d mailing list