assert(false)

Jonathan M Davis jmdavisProg at gmx.com
Thu Jun 20 15:36:33 PDT 2013


On Thursday, June 20, 2013 22:37:17 Joseph Rushton Wakeling wrote:
> On 06/20/2013 10:33 PM, Joseph Rushton Wakeling wrote:
> > On 06/20/2013 10:25 PM, Jonathan M Davis wrote:
> >> Putting it at the end of the function is unnecessary. The compiler
> >> already
> >> does that for you.
> > 
> > Then there are a bunch of functions in std.random ending with unnecessary
> > assert(false) statements. Shall I make this tweak as an addition to
> > current pull request?

If they're not needed, remove them.

> ... one is necessary as it's in a function that is supposed to return a
> value.

I don't think that that's supposed to be necessary. The only reason that that 
should happen is if the compiler can deterimine that the execution can 
definitely reach the end of the function.

> There are also some return; statements at the end of void functions.

That's pointless.

- Jonathan M Davis


More information about the Digitalmars-d-learn mailing list