www.digitalmars.com         C & C++   DMDScript  

c++.dos.16-bits - Exceptions

reply "Rajiv Bhagwat" <dataflow vsnl.com> writes:
The following program catches exceptions properly when compiled for 32
bits(-mn), but just prints 'abnormal program termination' for 16 bit
compiles (-ml).

#include <stdio.h>
int main(int argc,char *argv[]){
    try {
        throw "here it comes";
        }
    catch (const char *e) {
        printf("Exception: %s", e);
        }
    catch (...){
        printf("oh oh");
        }
    return 0;
    }

How about a quick fix?
Mar 21 2002
parent reply "Walter" <walter digitalmars.com> writes:
I just ran it (under XP) compiled as:
    sc test -Ae -ml
and it works as expected. I don't know why it isn't working for you.

-Walter

"Rajiv Bhagwat" <dataflow vsnl.com> wrote in message
news:a7cnar$gs8$1 digitaldaemon.com...
 The following program catches exceptions properly when compiled for 32
 bits(-mn), but just prints 'abnormal program termination' for 16 bit
 compiles (-ml).

 #include <stdio.h>
 int main(int argc,char *argv[]){
     try {
         throw "here it comes";
         }
     catch (const char *e) {
         printf("Exception: %s", e);
         }
     catch (...){
         printf("oh oh");
         }
     return 0;
     }

 How about a quick fix?
Mar 21 2002
parent reply "Rajiv Bhagwat" <dataflow vsnl.com> writes:
It is failing under Win98 SE. With lots of (other) problems reported for XP,
the chances of me switching over to XP immediately are slim.

And I know you don't have Win98! What to do now?

- Rajiv

"Walter" <walter digitalmars.com> wrote in message
news:a7d61b$pae$1 digitaldaemon.com...
 I just ran it (under XP) compiled as:
     sc test -Ae -ml
 and it works as expected. I don't know why it isn't working for you.

 -Walter

 "Rajiv Bhagwat" <dataflow vsnl.com> wrote in message
 news:a7cnar$gs8$1 digitaldaemon.com...
 The following program catches exceptions properly when compiled for 32
 bits(-mn), but just prints 'abnormal program termination' for 16 bit
 compiles (-ml).

 #include <stdio.h>
 int main(int argc,char *argv[]){
     try {
         throw "here it comes";
         }
     catch (const char *e) {
         printf("Exception: %s", e);
         }
     catch (...){
         printf("oh oh");
         }
     return 0;
     }

 How about a quick fix?
Mar 22 2002
next sibling parent "Walter" <walter digitalmars.com> writes:
Try putting fflush(stdout) after each printf.

"Rajiv Bhagwat" <dataflow vsnl.com> wrote in message
news:a7f7mv$1qkj$1 digitaldaemon.com...
 It is failing under Win98 SE. With lots of (other) problems reported for
XP,
 the chances of me switching over to XP immediately are slim.

 And I know you don't have Win98! What to do now?

 - Rajiv

 "Walter" <walter digitalmars.com> wrote in message
 news:a7d61b$pae$1 digitaldaemon.com...
 I just ran it (under XP) compiled as:
     sc test -Ae -ml
 and it works as expected. I don't know why it isn't working for you.

 -Walter

 "Rajiv Bhagwat" <dataflow vsnl.com> wrote in message
 news:a7cnar$gs8$1 digitaldaemon.com...
 The following program catches exceptions properly when compiled for 32
 bits(-mn), but just prints 'abnormal program termination' for 16 bit
 compiles (-ml).

 #include <stdio.h>
 int main(int argc,char *argv[]){
     try {
         throw "here it comes";
         }
     catch (const char *e) {
         printf("Exception: %s", e);
         }
     catch (...){
         printf("oh oh");
         }
     return 0;
     }

 How about a quick fix?
Mar 22 2002
prev sibling parent reply "Walter" <walter digitalmars.com> writes:
Ok, I found a win98 machine and tried it, and it works as expected. I don't
know why it fails for you. -Walter

"Rajiv Bhagwat" <dataflow vsnl.com> wrote in message
news:a7f7mv$1qkj$1 digitaldaemon.com...
 It is failing under Win98 SE. With lots of (other) problems reported for
XP,
 the chances of me switching over to XP immediately are slim.

 And I know you don't have Win98! What to do now?

 - Rajiv

 "Walter" <walter digitalmars.com> wrote in message
 news:a7d61b$pae$1 digitaldaemon.com...
 I just ran it (under XP) compiled as:
     sc test -Ae -ml
 and it works as expected. I don't know why it isn't working for you.

 -Walter

 "Rajiv Bhagwat" <dataflow vsnl.com> wrote in message
 news:a7cnar$gs8$1 digitaldaemon.com...
 The following program catches exceptions properly when compiled for 32
 bits(-mn), but just prints 'abnormal program termination' for 16 bit
 compiles (-ml).

 #include <stdio.h>
 int main(int argc,char *argv[]){
     try {
         throw "here it comes";
         }
     catch (const char *e) {
         printf("Exception: %s", e);
         }
     catch (...){
         printf("oh oh");
         }
     return 0;
     }

 How about a quick fix?
Mar 22 2002
parent "Rajiv Bhagwat" <dataflow vsnl.com> writes:
Walter, thanks for solving the problem. Removing -Nc from the CFLAGS does
make the program work as expected.
- Rajiv


"Walter" <walter digitalmars.com> wrote in message
news:a7ftmf$1ij2$1 digitaldaemon.com...
 Ok, I found a win98 machine and tried it, and it works as expected. I
don't
 know why it fails for you. -Walter

 "Rajiv Bhagwat" <dataflow vsnl.com> wrote in message
 news:a7f7mv$1qkj$1 digitaldaemon.com...
 It is failing under Win98 SE. With lots of (other) problems reported for
XP,
 the chances of me switching over to XP immediately are slim.

 And I know you don't have Win98! What to do now?

 - Rajiv

 "Walter" <walter digitalmars.com> wrote in message
 news:a7d61b$pae$1 digitaldaemon.com...
 I just ran it (under XP) compiled as:
     sc test -Ae -ml
 and it works as expected. I don't know why it isn't working for you.

 -Walter

 "Rajiv Bhagwat" <dataflow vsnl.com> wrote in message
 news:a7cnar$gs8$1 digitaldaemon.com...
 The following program catches exceptions properly when compiled for
32
 bits(-mn), but just prints 'abnormal program termination' for 16 bit
 compiles (-ml).

 #include <stdio.h>
 int main(int argc,char *argv[]){
     try {
         throw "here it comes";
         }
     catch (const char *e) {
         printf("Exception: %s", e);
         }
     catch (...){
         printf("oh oh");
         }
     return 0;
     }

 How about a quick fix?
Mar 24 2002