Penguin
Diff: PortabilityNotes
EditPageHistoryDiffInfoLikePages

Differences between version 3 and predecessor to the previous major change of PortabilityNotes.

Other diffs: Previous Revision, Previous Author, or view the Annotated Edit History

Newer page: version 3 Last edited on Thursday, October 12, 2006 3:37:57 pm by PerryLorier Revert
Older page: version 2 Last edited on Friday, July 7, 2006 9:44:30 am by AristotlePagaltzis Revert
@@ -154,12 +154,15 @@
  <verbatim> 
  uint64_t x; 
  printf("%"PRIu64,x); 
  </verbatim> 
+  
+! Avoid using other peoples types in your headers  
+Other peoples types change in size, sometimes at the flick of a #define. One example is off_t changes if LARGEFILE64 is defined under Linux. Use the c99 <tt><stdint.h></tt> types (uint64_t) so that they don't vary. If you absolutely must reference someone elses type, do so via a pointer (eg FILE*) and treat it as opaque.  
  
 !! See also 
  
 * [HP] has [a set of C portability notes | http://docs.hp.com/en/5074/portability.html], although it targets HP-UX. 
 * [Intel] has [a similar set of notes | http://www.intel.com/cd/ids/developer/asmo-na/eng/technologies/64bit/200519.htm?page=1] (for porting to [ia64] and [amd64]) 
  
 ---- 
 Part of CategoryProgramming