You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Barry Scott <ba...@barrys-emacs.org> on 2003/11/17 12:42:32 UTC

assert in release is available on windows

At 17-11-2003 07:26, =?ISO-8859-2?Q?Branko_=C8ibej?= wrote:
>Windows, because MS in its wisdom thinks it shouldn't be done (witness
>the fact that support for "assert()" is absent in the release version of
>the C runtime library). On the other hand, they give you DrWatson, which
>is quite useless without debug info.

You control assert with the NDEBUG macro. If defined the asserts disappear,
which is the default for release build. This is same on Unix and Windows.

Barry

[l:\users\barry]
 > type ass.c
#include <assert.h>
#include <stdlib.h>

int main()
         {
         assert( 0 );
         return 0;
         }

[l:\users\barry]
 > cl ass.c
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 12.00.8804 for 80x86
Copyright (C) Microsoft Corp 1984-1998. All rights reserved.

ass.c
Microsoft (R) Incremental Linker Version 6.00.8447
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.

/out:ass.exe
ass.obj

[l:\users\barry]
 > ass.exe
Assertion failed: 0, file ass.c, line 6

abnormal program termination

[l:\users\barry]
 > cl /DNDEBUG ass.c
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 12.00.8804 for 80x86
Copyright (C) Microsoft Corp 1984-1998. All rights reserved.

ass.c
Microsoft (R) Incremental Linker Version 6.00.8447
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.

/out:ass.exe
ass.obj

[l:\users\barry]
 > ass.exe

[l:\users\barry]
 >




---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: assert in release is available on windows

Posted by Branko Čibej <br...@xbc.nu>.
Barry Scott wrote:

>
>> Barry, please read what I wronte before trying to teach me C. In
>> MSVC, the
>> "assert" macro is implemented as a call to a support function. That
>> function is
>> not available in the Release version of the MS C runtime library,
>> which means
>> that _not_ defining NDEBUG _and_ linking against the release library
>> won't work.
>>
>> Your example "works" because, without any options, the compiler will
>> tell the
>> linker to use the debug library.
>
>
> This seems to work and ass.exe is linked against the release MSVCRT.dll.
> What have I misunderstood?

Well, well. Interesting. I spoke too hastily; _assert seems to be
present in version 7 of the release runtime library. I definitely
remember it not being there before; or perhaps it works for command-line
programs, but not for GUI apps.


-- 
Brane Čibej   <br...@xbc.nu>   http://www.xbc.nu/brane/


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: assert in release is available on windows

Posted by Barry Scott <ba...@barrys-emacs.org>.
>Barry, please read what I wronte before trying to teach me C. In MSVC, the
>"assert" macro is implemented as a call to a support function. That 
>function is
>not available in the Release version of the MS C runtime library, which means
>that _not_ defining NDEBUG _and_ linking against the release library won't 
>work.
>
>Your example "works" because, without any options, the compiler will tell the
>linker to use the debug library.

This seems to work and ass.exe is linked against the release MSVCRT.dll.
What have I misunderstood?

Barry

[l:\users\barry]
 > cl /MD ass.c
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 12.00.8804 for 80x86
Copyright (C) Microsoft Corp 1984-1998. All rights reserved.

ass.c
Microsoft (R) Incremental Linker Version 6.00.8447
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.

/out:ass.exe
ass.obj

[l:\users\barry]
 > ass.exe
Assertion failed: 0, file ass.c, line 6

This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.

[l:\users\barry]
 > dumpbin /dependents ass.exe
Microsoft (R) COFF Binary File Dumper Version 6.00.8447
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.


Dump of file ass.exe

File Type: EXECUTABLE IMAGE

   Image has the following dependencies:

     MSVCRT.dll

   Summary

         1000 .data
         1000 .rdata
         1000 .text

[l:\users\barry]
 >



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: assert in release is available on windows

Posted by br...@xbc.nu.
Quoting Barry Scott <ba...@barrys-emacs.org>:

> At 17-11-2003 07:26, =?ISO-8859-2?Q?Branko_=C8ibej?= wrote:
> >Windows, because MS in its wisdom thinks it shouldn't be done (witness
> >the fact that support for "assert()" is absent in the release version of
> >the C runtime library). On the other hand, they give you DrWatson, which
> >is quite useless without debug info.
> 
> You control assert with the NDEBUG macro. If defined the asserts disappear,
> which is the default for release build. This is same on Unix and Windows.

Really? Wow! Hey, can you also tell me what those '*' things measn in C programs?

O.K., sarcastic mode's off now. 

Barry, please read what I wronte before trying to teach me C. In MSVC, the
"assert" macro is implemented as a call to a support function. That function is
not available in the Release version of the MS C runtime library, which means
that _not_ defining NDEBUG _and_ linking against the release library won't work.

Your example "works" because, without any options, the compiler will tell the
linker to use the debug library.

    Brane

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org