The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > High Level Programming
Google UNIX.COM


High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
More on CEP Maturity: Capability Versus Reliability iBot Complex Event Processing RSS News 0 06-03-2008 02:50 AM
Seeing the screen output beyond the scroll capability for the last run command bimukt UNIX for Dummies Questions & Answers 1 05-02-2008 01:22 AM
One last question about capability macros frequency8 High Level Programming 1 05-23-2007 10:10 AM
saving macros for VIM yngwie UNIX for Dummies Questions & Answers 3 05-13-2007 09:26 PM
troff macros tonyt UNIX for Dummies Questions & Answers 2 01-03-2002 05:13 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 05-22-2007
Registered User
 

Join Date: May 2007
Location: San Francisco bay area
Posts: 32
How do capability macros get named?

The following is taken from some production code:

#ifdef LOCK_LOCKF
#ifdef HAVE_SYS_FILE_H
#include <sys/lockf.h>
#endif
#ifdef HAVE_SYS_FILE_H
#include <sys/file.h>
#endif
#define LOCK(file) fseek(file, 0L, 0), lockf(file, 1, 0L)
#define UNLOCK(file) fseek(file, 0L, 0), lockf(file, 0, 0L)
#endif /* LOCK_LOCKF */

#ifdef LOCK_LOCKING
#ifdef HAVE_SYS_LOCKING_H
#include <sys/locking.h>
#endif
#define LOCK(file) fseek(file, 0L, 0), chk_lock(file, 1)
#define UNLOCK(file) fseek(file, 0L, 0), chk_lock(file, 0)
#endif /* LOCK_LOCKING */

#ifdef LOCK_NONE
#define LOCK(file)
#define UNLOCK(file)
#endif /* LOCK_NONE */


Are the names LOCK_LOCKF, LOCK_LOCKING, and LOCK_NONE arbritrary? Ie, could they have been names LOCKF, LOCKING, and NONE instead?
Reply With Quote
Forum Sponsor
  #2  
Old 05-23-2007
...@...
 

Join Date: Feb 2004
Location: NM
Posts: 4,298
Yes. They are arbitrary. _DEFINE_POSIX_SOURCE _XOPEN_SOURCE are not - they are some of the feature test macros defined by POSIX, or GNU or whoever.

You should not change contents of compiler header files. And if you come up with a name conflict problem, change the name of your test macros to something else.
Reply With Quote
  #3  
Old 05-23-2007
Registered User
 

Join Date: Jan 2007
Posts: 2,965
The HAVE_xxxx defines come from "configure" which does a ton of test compilations to see what includes/functions/types/capabilities your machine has.
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 12:57 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0