Typical security issues in C++: why the GC isn't your enemy

Walter Bright newshound2 at digitalmars.com
Thu Dec 8 20:57:14 UTC 2022


On 12/6/2022 3:58 PM, Timon Gehr wrote:
> Variables are scoped within the innermost block that they are declared in. 
> Languages like Python that don't have block-local scoping just don't have this 
> particular problem (there's plenty of things to dislike about Python, but this 
> is something it got right I think):
> 
> ```python
> # note there is no x declared here
> if cond:
>      x = f()
> else:
>      x = g()
> print(x)
> ```

That looks like a matter of taste rather than righteousness.


> A particularly egregious case is the do-while loop:
> 
> ```d
> do{
>      int x=4;
>      if(condition){
>          ...
>          x++;
>      }
>      ...
> }while(x<10); // error
> ```
> 
> Just... why? x)

Because we love to annoy people.



More information about the Digitalmars-d mailing list