www.digitalmars.com         C & C++   DMDScript  

D - dmd 0.50 release

reply "Walter" <walter digitalmars.com> writes:
www.digitalmars.com/d/changelog.html
Nov 20 2002
next sibling parent reply Burton Radons <loth users.sourceforge.net> writes:
The code:

     void main ()
     {
         bit x;

         x = "bar" == "bar";
     }

Triggers the new implicit bit cast error.  It's type-dependent - 
comparing int won't trigger it.
Nov 20 2002
next sibling parent reply "Andrew Edwards" <crxace13 nospam.comcast.net> writes:
Thats because an explicit cast is required to convert from string "bar" to
bit.

Try:

void main ()
{
    bit x;
    x = (bit)"bar" == (bit)"bar";
}

By the way: can you take a look at cartoon.d? It's got the same problems in
D v0.50.

Here's the error:
cartoon.d(692): function checked (bit value) does not match argument types
(int)

I'm not sure how to typecast a function's return type;

"Burton Radons" <loth users.sourceforge.net> wrote in message
news:arfr2l$7h4$1 digitaldaemon.com...
 The code:

      void main ()
      {
          bit x;

          x = (bit)"bar" == "bar";
      }

 Triggers the new implicit bit cast error.  It's type-dependent -
 comparing int won't trigger it.

Nov 21 2002
next sibling parent "Andrew Edwards" <crxace13 nospam.comcast.net> writes:
Please disregard my earlier comment. I'll begin reading threads completely
before responding to them.

Andrew
Nov 21 2002
prev sibling parent "Walter" <walter digitalmars.com> writes:
"Andrew Edwards" <crxace13 nospam.comcast.net> wrote in message
news:arjg8p$1cv9$1 digitaldaemon.com...
 By the way: can you take a look at cartoon.d? It's got the same problems

 D v0.50.

 Here's the error:
 cartoon.d(692): function checked (bit value) does not match argument types
 (int)

 I'm not sure how to typecast a function's return type;

It sounds like you're trying to pass an int to a function that takes a bit. Try cast(bit) before the int expression.
Nov 21 2002
prev sibling parent "Roberto Mariottini" <rmariottini lycosmail.com> writes:
"Burton Radons" <loth users.sourceforge.net> ha scritto nel messaggio
news:arfr2l$7h4$1 digitaldaemon.com...
 The code:

      void main ()
      {
          bit x;

          x = "bar" == "bar";
      }

 Triggers the new implicit bit cast error.  It's type-dependent -
 comparing int won't trigger it.

Do you mean: x = ("bar" == "bar"); or (x = "bar") == "bar"; What is the right operator precendence? Ciao
Nov 22 2002
prev sibling parent Patrick Down <pat codemoon.com> writes:
The following generates the error
Internal error: ..\ztc\cgobj.c 3084

If I put the template in the same file where
it is used the error does not occur.

//File: eventtemplates.d----------------
template EvtType(T1,T2)
{
  struct Trigger
  {
    alias void delegate(Object sender,T1,T2) eventFunc;
    
    void Add(eventFunc f)
    {
    } 
  }
}

//File: winbase.d----------------
import eventtemplates;

instance EvtType(int,int) MouseEvent;

class Window 
{
  public
  {
    MouseEvent.Trigger mouseDown;
  }
}
Nov 25 2002