www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - enum : bool

reply BCS <ao pathlink.com> writes:
This works

enum Test : bool
{
	yes = true,
	no = false
}
	
void TestIt(Test);

TestIt(Test.yes);


Is any one makeing use of it? It allows for more usefull nameing.
Jun 12 2008
parent reply "Jarrett Billingsley" <kb3ctd2 yahoo.com> writes:
"BCS" <ao pathlink.com> wrote in message 
news:55391cb32e20b8ca9ab3c6527b36 news.digitalmars.com...
 This works

 enum Test : bool
 {
 yes = true,
 no = false
 }

 void TestIt(Test);

 TestIt(Test.yes);


 Is any one makeing use of it? It allows for more usefull nameing.
Would've been funny if enum MyBool : bool { True, False, FileNotFound } worked but alas, the compiler (shockingly!) isn't buggy and errors on the overflow..
Jun 12 2008
next sibling parent "Rioshin an'Harthen" <rharth75 hotmail.com> writes:
"Jarrett Billingsley" <kb3ctd2 yahoo.com> kirjoitti viestissä 
news:g2satg$2gl$1 digitalmars.com...
 Would've been funny if

 enum MyBool : bool
 {
    True,
    False,
    FileNotFound
 }

 worked but alas, the compiler (shockingly!) isn't buggy and errors on the 
 overflow..
Someone obviously reads the daily wtf...
Jun 12 2008
prev sibling parent reply Tower Ty <towerty msn.com.au> writes:
Jarrett Billingsley Wrote:

 "BCS" <ao pathlink.com> wrote in message 
 news:55391cb32e20b8ca9ab3c6527b36 news.digitalmars.com...
 This works

 enum Test : bool
 {
 yes = true,
 no = false
 }

 void TestIt(Test);

 TestIt(Test.yes);


 Is any one makeing use of it? It allows for more usefull nameing.
Would've been funny if enum MyBool : bool { True, False, FileNotFound } worked but alas, the compiler (shockingly!) isn't buggy and errors on the overflow..
Ok fellas so is there anything I can learn here? Can I put this to use somehow ? Is it showing a correct function or an incorrect one? More detail please.
Jun 13 2008
parent reply "Jarrett Billingsley" <kb3ctd2 yahoo.com> writes:
"Tower Ty" <towerty msn.com.au> wrote in message 
news:g2ujs9$qv3$1 digitalmars.com...

 Ok fellas so is there anything I can learn here?
 Can I put this to use somehow ?
 Is it showing a correct function or an incorrect one?
 More detail please.
http://thedailywtf.com/Articles/What_Is_Truth_0x3f_.aspx Classic example of code that's just... wow. _That_ bad.
Jun 13 2008
parent reply Tower Ty <towerty msn.com.au> writes:
Jarrett Billingsley Wrote:

 "Tower Ty" <towerty msn.com.au> wrote in message 
 news:g2ujs9$qv3$1 digitalmars.com...
 
 Ok fellas so is there anything I can learn here?
 Can I put this to use somehow ?
 Is it showing a correct function or an incorrect one?
 More detail please.
http://thedailywtf.com/Articles/What_Is_Truth_0x3f_.aspx Classic example of code that's just... wow. _That_ bad.
Good Jarrett . Only two states on and off. So you would be the man to make more of this . Our present day electronics are much more capable now of giving many more discernable positive states in charge from 0 to 5 volts ought be 6 steps of 1 volt or maybe 8 of a little less. If we had 8 it would be stunning in speed and capacity . Like the DNA UCAG codeing is much superior to on/off. In your position I wonder if you pursue any thought along those lines?
Jun 14 2008
next sibling parent "Jarrett Billingsley" <kb3ctd2 yahoo.com> writes:
"Tower Ty" <towerty msn.com.au> wrote in message 
news:g31cir$16tt$1 digitalmars.com...

 Good Jarrett . Only two states on and off.
 So you would be the man to make more of this . Our present day electronics 
 are much more capable now of giving many more discernable positive states 
 in charge from 0 to 5 volts ought be 6 steps of 1 volt or maybe 8 of a 
 little less.

 If we had 8 it would be stunning in speed and capacity . Like the DNA 
 UCAG codeing is much superior to on/off.

 In your position I wonder if you pursue any thought along those lines?
I haven't, at least not much. Though I think there might be some merit in analog computers that use a fully variable range of voltages (which bears a slight resemblance to how (we think) neurons work). Then there are quantum computers where each qubit is 1, 0, or "something else" and I don't even want to _know_ what those are all about ;)
Jun 14 2008
prev sibling parent BCS <ao pathlink.com> writes:
Reply to Tower,

 Jarrett Billingsley Wrote:
 
 "Tower Ty" <towerty msn.com.au> wrote in message
 news:g2ujs9$qv3$1 digitalmars.com...
 
 Ok fellas so is there anything I can learn here?
 Can I put this to use somehow ?
 Is it showing a correct function or an incorrect one?
 More detail please.
http://thedailywtf.com/Articles/What_Is_Truth_0x3f_.aspx Classic example of code that's just... wow. _That_ bad.
Good Jarrett . Only two states on and off. So you would be the man to make more of this . Our present day electronics are much more capable now of giving many more discernable positive states in charge from 0 to 5 volts ought be 6 steps of 1 volt or maybe 8 of a little less. If we had 8 it would be stunning in speed and capacity . Like the DNA UCAG codeing is much superior to on/off. In your position I wonder if you pursue any thought along those lines?
Analog computers have been built. They are much less tolerant to noise than digital ones. Also They /may/ get into some information theory issues there it becomes easier (less power etc.) to just pump up the clock speed than use more complex waveforms. (I know a guy who would know if anyone is interested)
Jun 15 2008