www.digitalmars.com         C & C++   DMDScript  

D - invariant

reply "Sean L. Palmer" <seanpalmer earthlink.net> writes:
Can invariant be used without the () ?  It doesn't seem necessary.

 invariant()
	{
	    assert(1 <= day && day <= 31);
	    assert(0 <= hour && hour < 24);
	}
Jun 15 2002
next sibling parent "Walter" <walter digitalmars.com> writes:
Yes. I never could decide if () should be required, so at the moment they
are optional. Note that there are no parameters to invariant's in any case.

"Sean L. Palmer" <seanpalmer earthlink.net> wrote in message
news:aegc1o$n0j$1 digitaldaemon.com...
 Can invariant be used without the () ?  It doesn't seem necessary.

  invariant()
 {
     assert(1 <= day && day <= 31);
     assert(0 <= hour && hour < 24);
 }
Jun 16 2002
prev sibling parent "Sandor Hojtsy" <hojtsy index.hu> writes:
"Sean L. Palmer" <seanpalmer earthlink.net> wrote in message
news:aegc1o$n0j$1 digitaldaemon.com...
 Can invariant be used without the () ?  It doesn't seem necessary.

  invariant()
 {
     assert(1 <= day && day <= 31);
     assert(0 <= hour && hour < 24);
 }
Especially compared to unittest without ( ) Since they have/mimic function like behaviour, I would be happy to see ( ) for both. Sandor
Jun 18 2002