From: jmccall4@sl0270.srl.ford.com (James McCallum)
Subject: Re: Ada and C++ asserts.
Date: 1996/07/17
Date: 1996-07-17T00:00:00+00:00 [thread overview]
Message-ID: <4sirua$18p@fiesta.srl.ford.com> (raw)
In-Reply-To: nh4tn9d9vw.fsf@paralysys
In article <nh4tn9d9vw.fsf@paralysys>, nasser@apldbio.com (Nasser Abbasi) writes:
>
>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:
>============
>
[... ada version deleted ...]
>
>
>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)
> ^^^^^^^^^^^^^
>
Form the Solaris man pages
assert(3C) C Library Functions assert(3C)
NAME
assert - verify program assertion
...
DESCRIPTION
This macro is useful for putting diagnostics into programs.
When it is executed, if expression is false (zero), assert()
prints
Assertion failed: expression, file xyz, line nnn
on the standard error output and aborts....
^^^^^^
abort(3C) C Library Functions abort(3C)
NAME
abort - terminate the process abnormally
...
NOTES
Catching the signal is intended to provide the application
writer with a portable means to abort processing, free from
possible interference from any implementation-provided
library functions. If SIGABRT is neither caught nor
ignored, and the current directory is writable, a core dump
may be produced.
^^^^
It looks as if the C++ version does work. :)
James.
--
---
James McCallum Acro Service Corp
on contract to Engine and Processes Dept.
Tel: +1 313 248 9017 Ford Motor Co.
e-mail: external internal profs
jmccall4@ford.com jmccall4@sl0270.srl jmccall4
prev parent reply other threads:[~1996-07-17 0:00 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
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 message]
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox