comp.lang.ada
 help / color / mirror / Atom feed
* Ada and C++ asserts.
@ 1996-07-15  0:00 Nasser Abbasi
  1996-07-15  0:00 ` Stephen Leake
                   ` (7 more replies)
  0 siblings, 8 replies; 13+ messages in thread
From: Nasser Abbasi @ 1996-07-15  0:00 UTC (permalink / raw)




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 <assert.h>
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).







^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~1996-07-22  0:00 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-07-15  0:00 Ada and C++ asserts Nasser Abbasi
1996-07-15  0:00 ` Stephen Leake
1996-07-15  0:00 ` Fergus Henderson
1996-07-15  0:00 ` Nasser Abbasi
1996-07-16  0:00   ` Robert Dewar
1996-07-18  0:00   ` Ian Johnston
1996-07-22  0:00   ` Richard Curnow
1996-07-15  0:00 ` Robert Dewar
1996-07-15  0:00 ` Giuliano Carlini
1996-07-16  0:00 ` Eric Kline
1996-07-16  0:00   ` Jon S Anthony
1996-07-16  0:00 ` Ian Johnston
1996-07-17  0:00 ` James McCallum

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox