Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > is _unix defined?

is _unix defined?
Thread Tools
Fresh-Faced Recruit
Join Date: Jun 2000
Status: Offline
Reply With Quote
Oct 26, 2003, 04:13 PM
 
I'm porting some small apps from other platforms and a lot of the code uses
Code:
#if defined(_unix)
calls and then links from standard files. The problem is that these checks are apparently resolving to false. Now I could go through and just modify the checks to just do whatever it is they need to do for Unix, but is there some reason it's not reading _unix as defined? Is this in a Framework somewhere and I'm just missing it?

Forgive me if this is a newbie question -- I've done a lot of programming, just not on OS X.
     
Mac Enthusiast
Join Date: Jan 2001
Status: Offline
Reply With Quote
Oct 26, 2003, 08:09 PM
 
Dunno, never seen _unix used before. Of course, you could always just do

Code:
#define _unix
somewhere at the top of the files.
     
Fresh-Faced Recruit
Join Date: Jun 2000
Status: Offline
Reply With Quote
Oct 26, 2003, 08:15 PM
 
Originally posted by 00101001:
Dunno, never seen _unix used before. Of course, you could always just do

Code:
#define _unix
somewhere at the top of the files.
Yeah, that's ultimately what I'm doing. I just didn't know if perhaps _unix was defined in some Framework that I should be including otherwise. Essentially wanted to be sure that it wasn't a symptom of a larger problem.

Thanks for the help!
     
Addicted to MacNN
Join Date: Mar 2000
Location: London, UK
Status: Offline
Reply With Quote
Oct 27, 2003, 06:37 AM
 
It looks like a flag that is defined during the build process, like in a Makefile or something. BTW, to save adding it to the top of every source file, just add -D_unix to the CFLAGS.
     
Mac Elite
Join Date: Sep 2000
Location: in front of the keyboard
Status: Offline
Reply With Quote
Oct 27, 2003, 08:54 AM
 
what kind of overly generalized crap is that?

Might as well put
Code:
#if defined(_is_a_computer)
What code is this?
signatures are a waste of bandwidth
especially ones with political tripe in them.
     
Fresh-Faced Recruit
Join Date: Jun 2000
Status: Offline
Reply With Quote
Oct 27, 2003, 09:01 AM
 
Originally posted by Kristoff:
what kind of overly generalized crap is that?

Might as well put
Code:
#if defined(_is_a_computer)
What code is this?
Well, if you want to get similar functionality across different systems, you often need to use different libraries and write your code differently. Using the pre-processor tags, the compiler only bothers with the relevant code, but you can keep it all in one place for more convenient editing. In this case I'm dealing with time libraries.

Pretty standard practice for cross-platform code.
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 07:19 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2