www.digitalmars.com         C & C++   DMDScript  

D - Illegal instruction running very simple program

reply "Andres Rodriguez" <rodriguez ai.sri.com> writes:
Running the following program gave an illegal instruction error
from windows (attached is the windows dialog showing the error).
Any clues?  Thanks in advance.

-----

Error from windows:

The NTVDM has encountered an illegal instruction.
CS:0dce IP001d OP:ff ff ae ff ff Choose 'Close' to terminate the application

-----

module java.util.test.TestArrayList;

int main (char[][] args) {
    printf("hello world\n");
    printf("args.length = %d\n", args.length);
    for (int i = 0; i < args.length; i++)
 printf("args[%d] = '%s'\n", i, (char *)args[i]);
    return 0;
}
Feb 01 2004
parent reply "Andres Rodriguez" <rodriguez ai.sri.com> writes:
Sorry, my mistake, I was invoking the compiler with a '-c' and '-of'
Should thi be an error?  Should the compiler issue a warning?  Or is
there a case where you might want to do this?


"Andres Rodriguez" <rodriguez ai.sri.com> wrote in message
news:bvjg9a$dck$1 digitaldaemon.com...
 Running the following program gave an illegal instruction error
 from windows (attached is the windows dialog showing the error).
 Any clues?  Thanks in advance.

 -----

 Error from windows:

 The NTVDM has encountered an illegal instruction.
 CS:0dce IP001d OP:ff ff ae ff ff Choose 'Close' to terminate the

 -----

 module java.util.test.TestArrayList;

 int main (char[][] args) {
     printf("hello world\n");
     printf("args.length = %d\n", args.length);
     for (int i = 0; i < args.length; i++)
  printf("args[%d] = '%s'\n", i, (char *)args[i]);
     return 0;
 }

Feb 01 2004
next sibling parent reply "Samuel" <samuelmv ya.com> writes:
Hi Andrés, your program has a little mistake.

In D you can not use %s directly because the strings are not null ended. Use
%.*s instead of %s and it must work.

I think you need to read the documentation a bit more ;-).

Regards.

P.S.: ¿Otro español?

"Andres Rodriguez" <rodriguez ai.sri.com> escribió en el mensaje
news:bvjgkd$e0c$1 digitaldaemon.com...
 Sorry, my mistake, I was invoking the compiler with a '-c' and '-of'
 Should thi be an error?  Should the compiler issue a warning?  Or is
 there a case where you might want to do this?


 "Andres Rodriguez" <rodriguez ai.sri.com> wrote in message
 news:bvjg9a$dck$1 digitaldaemon.com...
 Running the following program gave an illegal instruction error
 from windows (attached is the windows dialog showing the error).
 Any clues?  Thanks in advance.

 -----

 Error from windows:

 The NTVDM has encountered an illegal instruction.
 CS:0dce IP001d OP:ff ff ae ff ff Choose 'Close' to terminate the

 -----

 module java.util.test.TestArrayList;

 int main (char[][] args) {
     printf("hello world\n");
     printf("args.length = %d\n", args.length);
     for (int i = 0; i < args.length; i++)
  printf("args[%d] = '%s'\n", i, (char *)args[i]);
     return 0;
 }


Feb 01 2004
next sibling parent "Samuel" <samuelmv ya.com> writes:
My apologies, I've try the program and it works (I think I need to read more
the
documentation ;-)

    Samuel
Feb 01 2004
prev sibling parent reply "Carlos Santander B." <carlos8294 msn.com> writes:
Samuel wrote:
 P.S.: ¿Otro español?


No español, pero sí ecuatoriano. ----------------------- Carlos Santander Bernal
Feb 01 2004
parent "Samuel" <samuelmv ya.com> writes:
 Samuel wrote:
 P.S.: ¿Otro español?


No español, pero sí ecuatoriano. ----------------------- Carlos Santander Bernal

Encantado, parece que hay unos cuantos hispanohablantes en este foro. Samuel Martín Valentín
Feb 01 2004
prev sibling parent "Carlos Santander B." <carlos8294 msn.com> writes:
Andres Rodriguez wrote:
 Sorry, my mistake, I was invoking the compiler with a '-c' and '-of'
 Should thi be an error?  Should the compiler issue a warning?  Or is
 there a case where you might want to do this?


Yes, that's the problem. Drop the "-c". ----------------------- Carlos Santander Bernal
Feb 01 2004