Re: C Assert in BSD Static Library

2015-06-28 Thread Clark S. Cox III

 On Jun 23, 2015, at 17:24, Raglan T. Tiger r...@crusaderrabbit.net wrote:
 
 On Jun 23, 2015, at 5:48 PM, Scott Ribe scott_r...@elevated-dev.com wrote:
 
 Just to be clear, =1 is actually not necessary.
 
 
 Yes.  But of course Xcode puts DEBUG=1 in the debug configuration.
 
 Just doing belt and suspenders.
 
 What if the compiler did 
 
 #ifdef NDEBUG
 
 if ( NDEBUG == 1 ) turn off stuff 
 
 #endif

If the compiler is doing that, then it is simply wrong. If NDEBUG is defined at 
all, then assert is disabled. This is guaranteed by the C standard.

-- 
Clark S. Cox III
clarkc...@gmail.com
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: C Assert in BSD Static Library

2015-06-23 Thread Scott Ribe
On Jun 23, 2015, at 11:14 AM, Raglan T. Tiger r...@crusaderrabbit.net wrote:
 
 Are these set in the Library project or the App project that links to them?

It'll have to be the library; the app project has no influence over what is 
compiled into the library.

As a guess, you might want to define NDEBUG=1. That is *very* common practice 
for release builds on many platforms, but IIRC Xcode doesn't include that in 
default templates.

But of course, you should probably actually look into these asserts and see how 
they're defined. I think the standard-lib assert is turned off by NDEBUG, but 
people build up all sorts of ASSERT macros of their own, with all sorts of 
config options...

-- 
Scott Ribe
scott_r...@elevated-dev.com
http://www.elevated-dev.com/
https://www.linkedin.com/in/scottribe/
(303) 722-0567 voice






___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

C Assert in BSD Static Library

2015-06-23 Thread Raglan T. Tiger
My cocoa app links to a number of C++ BSD Static libraries. These libraries are 
built in Release configuration.  They have Asset Macros in them.

The Asserts are fired in the release builds.  My Windows programmer tele that 
Asserts do not get compiled into release code on windows.

What are my options / setting for not compiling asserts into release builds?

Are these set in the Library project or the App project that links to them?




-rags




___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: C Assert in BSD Static Library

2015-06-23 Thread Jens Alfke
Define the preprocessor symbol NDEBUG, and assert( ) calls will be ignored. 
It’s simplest to add this in the Build Settings under “Preprocessor Macros”, 
only for the Release configuration.

—Jens
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: C Assert in BSD Static Library

2015-06-23 Thread Greg Parker

 On Jun 23, 2015, at 10:14 AM, Raglan T. Tiger r...@crusaderrabbit.net wrote:
 
 My cocoa app links to a number of C++ BSD Static libraries. These libraries 
 are built in Release configuration.  They have Asset Macros in them.
 
 The Asserts are fired in the release builds.  My Windows programmer tele that 
 Asserts do not get compiled into release code on windows.
 
 What are my options / setting for not compiling asserts into release builds?

First question: how are the asserts spelled? Different assert calls have 
different configuration. For example, the switch to disable assert() has no 
effect on NSAssert().


 Are these set in the Library project or the App project that links to them?

Assert behavior is usually set when the library is compiled. Sometimes the 
library will have a runtime variable that affects assert behavior.


-- 
Greg Parker gpar...@apple.com Runtime Wrangler



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: C Assert in BSD Static Library

2015-06-23 Thread Raglan T. Tiger
 On Jun 23, 2015, at 5:48 PM, Scott Ribe scott_r...@elevated-dev.com wrote:
 
 Just to be clear, =1 is actually not necessary.


Yes.  But of course Xcode puts DEBUG=1 in the debug configuration.

Just doing belt and suspenders.

What if the compiler did 

#ifdef NDEBUG

if ( NDEBUG == 1 ) turn off stuff 

#endif

Just sayin'.

-rags
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: C Assert in BSD Static Library

2015-06-23 Thread Raglan T. Tiger

-rags



 On Jun 23, 2015, at 1:59 PM, Greg Parker gpar...@apple.com wrote:
 
 
 On Jun 23, 2015, at 10:14 AM, Raglan T. Tiger r...@crusaderrabbit.net 
 wrote:
 
 My cocoa app links to a number of C++ BSD Static libraries. These libraries 
 are built in Release configuration.  They have Asset Macros in them.
 
 The Asserts are fired in the release builds.  My Windows programmer tele 
 that Asserts do not get compiled into release code on windows.
 
 What are my options / setting for not compiling asserts into release builds?
 
 First question: how are the asserts spelled? Different assert calls have 
 different configuration. For example, the switch to disable assert() has no 
 effect on NSAssert().
 
 
 Are these set in the Library project or the App project that links to them?
 
 Assert behavior is usually set when the library is compiled. Sometimes the 
 library will have a runtime variable that affects assert behavior.
 

The Asserts are in the static libraries and are C++ and writen like:

assert( 0.0 = u );

I have added NDEBUG=1 in the project release configurationpre-processor macro 
definitions per results here.

Thanks all.

-rags
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: C Assert in BSD Static Library

2015-06-23 Thread Scott Ribe
On Jun 23, 2015, at 5:35 PM, Raglan T. Tiger r...@crusaderrabbit.net wrote:
 
 I have added NDEBUG=1 in the project release configurationpre-processor macro 
 definitions per results here.

Just to be clear, =1 is actually not necessary. The standard is that if NDEBUG 
is defined, assert is turned off. It's just my personal style, that I refuse to 
define it to anything other than 1, because why should I have to remember that 
NDEBUG=0 also turns it *on*? As does NDEBUG?

-- 
Scott Ribe
scott_r...@elevated-dev.com
http://www.elevated-dev.com/
https://www.linkedin.com/in/scottribe/
(303) 722-0567 voice






___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com