From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 109fba,f59c1f5fb86a1b54 X-Google-Attributes: gid109fba,public X-Google-Thread: 103376,a0e076952eca80d4 X-Google-Attributes: gid103376,public From: nasser@apldbio.com (Nasser Abbasi) Subject: Ada and C++ asserts. Date: 1996/07/15 Message-ID: #1/1 X-Deja-AN: 168818812 sender: news@biosys.apldbio.COM original-sender: nasser@apldbio.com followup-to: comp.lang.ada organization: Applied BioSystems newsgroups: comp.lang.ada,comp.lang.c++ Date: 1996-07-15T00:00:00+00:00 List-Id: I am trying to keep an open mind about things, but see for yourself, a simple program to test assertions, the Ada version works fine, the C++ core dumps after it displays the assertion statment. This is on Sun Solaris 2.5, using sun CC V4.0, and GNAT 3.05 . I might be doing something wrong in the C++ version, [if so, please tell me what I am doing wrong!] but I can not seem to see it. (after all, it is just a 2 line program ! ) May be this should win an award for the smallest C++ program to core dump :) ada version: ============ -------------------------------------------- with Ada.Text_Io; use Ada.Text_Io; procedure Test_Assert is I: Integer := 0; begin pragma Assert(I = 1, "found i /= 1 !"); null; end Test_Assert; ---------------------------------------------- ... now build and run it... $gnatmake -gnata test_assert.adb $test_assert raised SYSTEM.ASSERTIONS.ASSERT_FAILURE : found i /= 1 ! C++ version ============ ------------------------------------------- #include main() { int i=0; assert(i == 1); return 0; } ------------------------------------------ .... now build and run $CC t2.cc $a.out Assertion failed: i == 1, file t2.cc, line 8 Abort (core dumped) ^^^^^^^^^^^^^ -- Nasser Abbasi. C/C++/Ada Solaris. GeneAssist - A client/server application for Nucleic acid and protein sequence search and analysis. Perkin Elmer - Applied BioSystem division. email: nasser@apldbio.com MSEE(control), MSCS, MSCE, FM (Fide Chess Master).