Re: Compiling for 10.9 through 10.12

2016-07-21 Thread Rich Siegel
On Thursday, July 21, 2016, Charles Francoise 
<char...@meetlima.com> wrote:


I’m trying to find a way to either build for 10.12 from 
10.11, or build from 10.12 and run for lower versions.


There are two relevant settings: the SDK and the "Deployment 
Target". There used to be multiple options for the SDK, but 
lately Xcode has started putting the SDK and the OS version in 
lock step, so that Xcode 7 includes only the 10.11 SDK and (I 
presume) Xcode 8 includes only the 10.12 SDK. This can be 
annoying sometimes, but is not a serious problem in most cases.


The "Deployment Target" setting is more relevant here, I think. 
That setting should be set to the lowest OS version which you 
plan to support. (In this case, 10.9.)


Even with all of this, you still have to code to the minimum 
supported OS. If you have to run on 10.9, you can't call APIs 
that don't exist there. Neither the OS nor the tool chain will 
stop you from doing so.


In the specific case, I see that clock_gettime() doesn't exist 
on 10.11, which means it probably doesn't exist on prior OS 
versions either, and that means that you can't call it unless 
you do a runtime test to see if it's there. (The address of a 
weak-linked function is NULL if the function is unavailable at runtime.)


Good luck,

R.
--
Rich Siegel Bare Bones Software, Inc.
<sie...@barebones.com>  <http://www.barebones.com/>

Someday I'll look back on all this and laugh... until they 
sedate me.



___
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list  (Xcode-users@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/xcode-users/archive%40mail-archive.com

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

Re: malloc was optimized out

2016-07-04 Thread Rich Siegel

On Monday, July 4, 2016, Quincey Morris
<quinceymor...@rivergatesoftware.com> wrote:


I don’t know the answer, but it seems to me at least possible that it
didn’t fail. It’s at least possible that it gave you an unmapped
virtual allocation of the size you asked for.


In fact this is likely, at least on x86_64. I suppose it's 
possible that when targeting i386, you'd get a different outcome.


I've seen situations in which code like this:

T *foo = new T[n];  // for some large integer value "n"

if (nil != t)
{
/*...*/
}

ends up with the (nil != t) optimized away in release builds, 
because the compiler assumes that operator new[] will either 
succeed or throw a bad_alloc. This, in any case, operator new 
never returns nil, so there's no need to check its result.


On the other hand:

T *foo = new(std::nothrow) T[n];

if (nil != t)
{
/*...*/
}

Here, the compiler knows that operator new will explicitly *not* 
throw and *may* fail (again, at least on i386).


It may be that when targeting x86_64, checking for nil (or NULL) 
results from allocations is passé and gets optimized away, 
because as we all know, "malloc() never fails"...


R.
--
Rich Siegel Bare Bones Software, Inc.
<sie...@barebones.com>  <http://www.barebones.com/>

Someday I'll look back on all this and laugh... until they 
sedate me.



___
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list  (Xcode-users@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/xcode-users/archive%40mail-archive.com

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

Re: How to specify a file uses an External Editor?

2015-11-10 Thread Rich Siegel

On Tuesday, November 10, 2015, Dave <d...@looktowindward.com> wrote:


Is there anyway I can have a particular file or files open in an
External Editor when it is opened in XCode?

I have some .applescript files in my project and want to always open
them in ScriptEditor.


Just use the Finder's "Get Info" window as usual to make sure 
that the .applescript files open in the correct application by 
default. Thereafter, using the "Open with External Editor" 
command in Xcode will open them in the Script Editor.


R.
--
Rich Siegel Bare Bones Software, Inc.
<sie...@barebones.com>  <http://www.barebones.com/>

Someday I'll look back on all this and laugh... until they 
sedate me.



___
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list  (Xcode-users@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/xcode-users/archive%40mail-archive.com

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