Struct should be invalid after move

Steven Schveighoffer schveiguy at gmail.com
Fri Nov 30 16:52:12 UTC 2018


On 11/30/18 10:01 AM, burjui wrote:
> On Tuesday, 27 November 2018 at 19:28:13 UTC, Steven Schveighoffer wrote:
>> Note that complete flow analysis is equivalent to the halting problem. 
>> So really, you can never get it perfect, and therefore, there are 
>> always going to be some things you can't catch. So it's impossible to 
>> fulfill that promise in any compiler.
> 
> That's a straw man. I was not talking about complete flow analysis and 
> getting it perfect. Some form of flow analysis is already build into 
> DMD, so I suggest to:
> 1. At least enable it unconditionally

I'm not a compiler writer, and don't know the first thing about the 
requirements, but I would hazard a guess that the reason this is the 
case is if optimization isn't enabled, some critical pieces needed to do 
flow analysis aren't present. I don't think it's orthogonal.

> 2. Improve it to account for more complex scenarios than simple null 
> dereferencing

I think any improvements to the flow analysis would be welcome! The more 
the compiler can flag as an obvious error, the better.

> Anyway, the point I am trying to make here is that it's much better to 
> make one compiler smarter, than to rely on many users' 
> not-even-close-to-perfect discipline, and I think C++ proves it. 
> Software development these days is too complex to comprehend without the 
> help of tools, which must become smarter to really have an impact and 
> stay in use.

Best effort to detect problems is generally what we have with D. My 
point was simply that any time you solve "how come it doesn't detect 
this", someone will highlight another problem that is harder or 
impossible to solve.

-Steve


More information about the Digitalmars-d mailing list