www.digitalmars.com         C & C++   DMDScript  

D - internal error

reply "Carlos" <carlos8294 msn.com> writes:
what does it mean?
Internal error: ..\ztc\cod4.c 346

-------------------------
Carlos 8294
http://carlos3.netfirms.com/
Jun 17 2002
next sibling parent reply "Walter" <walter digitalmars.com> writes:
It means there's an assertion failure in the compiler source. What it also
means is I can't fix it unless you send me an example that trips the
error! -Walter

"Carlos" <carlos8294 msn.com> wrote in message
news:aem6s8$vt3$1 digitaldaemon.com...
 what does it mean?
 Internal error: ..\ztc\cod4.c 346

Jun 18 2002
parent reply "Carlos" <carlos8294 msn.com> writes:
By commenting out, I found the cause of the error:

void agregarPais(inout pais[] l)        //add country
{
    char [30] np;
    printf("Ingrese nombre de país: ");     //enter a name
    scanf("%s",(char*)np);

    if ( encontrado(l,np)>0 )      //"encontrado" means "found"
        printf("Ya existe %.*s\n",np);         //"ya existe" means "already
exists"
    else {
        int n=l.length+1;
        l.length=n;
        l[n].nombre=np;
        ...
    }
}

(... are just printf's)

where encontrado() is

int encontrado (pais[] p,char[] n)
{
    for (int i=0;i<p.length;i++)
        if ( n==(char[] )p[i].nombre )
            return i+1;
    return 0;
}

and pais is

struct pais {
    char [30] nombre;       //name
    ...
};

(... are just int's)

I know the problem is in the first function, because another function uses
encontrado(), but there's nothing wrong with that. Any idea?
Jun 18 2002
parent reply "Carlos" <carlos8294 msn.com> writes:
this is the line!

         l[n].nombre=np;

i'm assigning a char[30] to another. obviously, it's the wrong approach. how do i do it?
Jun 18 2002
parent reply "Carlos" <carlos8294 msn.com> writes:
"Carlos" <carlos8294 msn.com> escribió en el mensaje
news:aeo6ao$98$1 digitaldaemon.com...
 this is the line!

         l[n].nombre=np;

i'm assigning a char[30] to another. obviously, it's the wrong approach.

 do i do it?

Jun 18 2002
parent reply "Carlos" <carlos8294 msn.com> writes:
I hate when people do it, but now it has happened to me.
To compare two char [30], there're 2 ways: using == or using ===. By using
==, it only compares the first character and the length (I don't need that).
But by using === I get this:

Internal error: ..\ztc\cod3.c 711

So?
Jun 18 2002
next sibling parent reply "anderson" <anderson firestar.com.au> writes:
"Carlos" <carlos8294 msn.com> wrote in message
news:aeok8r$eo1$1 digitaldaemon.com...
 I hate when people do it, but now it has happened to me.
 To compare two char [30], there're 2 ways: using == or using ===. By using
 ==, it only compares the first character and the length (I don't need

 But by using === I get this:

 Internal error: ..\ztc\cod3.c 711

 So?

"==" is ment to compare the entire array (well until it find to items that match). "===" compares the reference. I think this complier bug has already been reported to Walter.
Jun 18 2002
parent reply Jonathan Andrew <jon ece.arizona.edu> writes:
anderson wrote:

 "Carlos" <carlos8294 msn.com> wrote in message
 news:aeok8r$eo1$1 digitaldaemon.com...
 
I hate when people do it, but now it has happened to me.
To compare two char [30], there're 2 ways: using == or using ===. By using
==, it only compares the first character and the length (I don't need

But by using === I get this:

Internal error: ..\ztc\cod3.c 711

So?

"==" is ment to compare the entire array (well until it find to items that match). "===" compares the reference. I think this complier bug has already been reported to Walter.

Are < and > supposed to work on arrays yet? I really don't want to use strcmp()! -Jon
Jun 19 2002
parent reply "Walter" <walter digitalmars.com> writes:
"Jonathan Andrew" <jon ece.arizona.edu> wrote in message
news:3D111140.2000009 ece.arizona.edu...
 Are < and > supposed to work on arrays yet? I really don't
 want to use strcmp()!

Yes, they should.
Jun 19 2002
parent reply "Carlos" <carlos8294 msn.com> writes:
"Walter" <walter digitalmars.com> escribió en el mensaje
news:aer8jq$6qp$1 digitaldaemon.com...
 "Jonathan Andrew" <jon ece.arizona.edu> wrote in message
 news:3D111140.2000009 ece.arizona.edu...
 Are < and > supposed to work on arrays yet? I really don't
 want to use strcmp()!

Yes, they should.

if (charArr1 < charArr2 || charArr1 > charArr2) { //arrays are different ... } else { //array are the same ... } it should work?
Jun 19 2002
parent reply "Sean L. Palmer" <seanpalmer earthlink.net> writes:
Sounds inefficient.

Sean

"Carlos" <carlos8294 msn.com> wrote in message
news:aerm5r$jrl$1 digitaldaemon.com...
 "Walter" <walter digitalmars.com> escribió en el mensaje
 news:aer8jq$6qp$1 digitaldaemon.com...
 "Jonathan Andrew" <jon ece.arizona.edu> wrote in message
 news:3D111140.2000009 ece.arizona.edu...
 Are < and > supposed to work on arrays yet? I really don't
 want to use strcmp()!

Yes, they should.

if (charArr1 < charArr2 || charArr1 > charArr2) { //arrays are different ... } else { //array are the same ... } it should work?

Jun 19 2002
parent "Carlos" <carlos8294 msn.com> writes:
"Sean L. Palmer" <seanpalmer earthlink.net> escribió en el mensaje
news:aermv1$kgr$1 digitaldaemon.com...
 Sounds inefficient.

 Sean

i know, but would it? (too late here to code something)
Jun 19 2002
prev sibling parent "Walter" <walter digitalmars.com> writes:
Thanks for the reports. I'll take care of it. -Walter

"Carlos" <carlos8294 msn.com> wrote in message
news:aeok8r$eo1$1 digitaldaemon.com...
 I hate when people do it, but now it has happened to me.
 To compare two char [30], there're 2 ways: using == or using ===. By using
 ==, it only compares the first character and the length (I don't need

 But by using === I get this:

 Internal error: ..\ztc\cod3.c 711

 So?

Jun 19 2002
prev sibling parent Pavel Minayev <evilone omen.ru> writes:
On Mon, 17 Jun 2002 21:51:36 -0500 "Carlos" <carlos8294 msn.com> wrote:

 what does it mean?
 Internal error: ..\ztc\cod4.c 346

It means that you should send the code which produced such an error to Walter, for him to reproduce the error and fix the bug. =)
Jun 18 2002